Part Number Hot Search : 
MAX41 IRFZ34NL XC18V IRFZ34NL MAX15 TP0205AD IRFU9110 LT1027D
Product Description
Full Text Search
 

To Download M32170F4VWG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  msd -m32170-u-0003 mitsubishi electric corporation mitsubishi electric semiconductor systems corporation note information in this manual may be changed without prior notice. mitsubishi 32-bit risc single-chip microcomputers m32r family m32r/e series 2000-03-17 ver0.10 group m32170f6vfp/wg m32170f4vfp/wg m32170f3vfp/wg users manual 32170 preliminary advanced and ever advancing
keep safety first in your circuit designs! notes regarding these materials l mitsubishi electric corporation puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of non-flammable material or (iii) prevention against any malfunction or mishap. l these materials are intended as a reference to assist our customers in the selection of the mitsubishi semiconductor product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to mitsubishi electric corporation or a third party. l mitsubishi electric corporation assumes no responsibility for any damage, or infringement of any third-party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. l all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by mitsubishi electric corporation without notice due to product improvements or other reasons. it is therefore recommended that customers contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. mitsubishi electric corporation assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by mitsubishi electric corporation by various means, including the mitsubishi semiconductor home page (http:// www.mitsubishichips.com). l when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. mitsubishi electric corporation assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. l mitsubishi electric corporation semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. l the prior written approval of mitsubishi electric corporation is necessary to reprint or reproduce in whole or in part these materials. l if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. l please contact mitsubishi electric corporation or an authorized mitsubishi semicon ductor product distributor for further details on these materials or the products con tained therein.
preface this manual describes the hardware specifica- tions of mitsubishis 32170 group of 32-bit cmos microcomputers. this manual was created to help you under- stand the hardware specifications of the 32170-group microcomputers so you can take full advantage of the versatile performance ca- pabilities of these microcomputers. the cpu features and the functionality of each internal peripheral circuit are described in detail, which we hope will prove useful for your circuit de- sign. for details about the m32r-family software products and development support tools, please refer to the users manuals and related other documentation included with your prod- ucts and tools.
how to read internal i/o register tables ? bit numbers: each register is connected with an internal bus of 16-bit wide, so the bit numbers of the registers located at even addresses are d0-d7, and those at odd addresses are d8-d15. ? state of register at reset: represents the initial state of each register immediately after reset with hexadecimal numbers (undefined bits after reset are indicated each in column ? .) ? at read: ... read enabled ? ... read disabled (read value invalid) 0 ... read always as 0 1 ... read always as 1 ? at write: : write enabled : write enable conditionally (include some conditions at write) - : write disabled (written value invalid) abit 12 34 d0 d bit name function w r 0 not assigned. 0 1 abit (...................) 0: ----- 1: ----- 3 2 not implemented in the shaded portion. bbit cbit bbit (...................) cbit (...................) 0: ----- 1: ----- 0: ----- 1: ----- registers represented with thick rectangles are accessible only with halfwords or words (not accessible with bytes). 1 2 3 4
(1) contents chapter 1 overview 1.1 outline of the 32170 .......................................................................................... 1-2 1.1.1 m32r family cpu core ............................................................................. 1-2 1.1.2 built-in multiply-accumulate operation function ........................................ 1-3 1.1.3 built-in flash memory and ram ................................................................. 1-3 1.1.4 built-in clock frequency multiplier ............................................................. 1-4 1.1.5 built-in powerful peripheral functions ........................................................ 1-4 1.1.6 built-in full-can function .......................................................................... 1-6 1.1.7 built-in debug function .............................................................................. 1-6 1.2 block diagram ................................................................................................... 1-7 1.3 pin function .................................................................................................... 1-10 1.4 pin layout ........................................................................................................ 1-18 chapter 2 cpu 2.1 cpu registers ................................................................................................... 2-2 2.2 general-purpose registers .............................................................................. 2-2 2.3 control registers .............................................................................................. 2-3 2.3.1 processor status word register: psw (cr0) ............................................ 2-4 2.3.2 condition bit register: cbr (cr1) ............................................................. 2-5 2.3.3 interrupt stack pointer: spi (cr2) .............................................................. 2-5 user stack pointer: spu (cr3) .................................................................. 2-5 2.3.4 backup pc: bpc (cr6) .............................................................................. 2-5 2.4 accumulator ...................................................................................................... 2-6 2.5 program counter .............................................................................................. 2-6 2.6 data formats ..................................................................................................... 2-7 2.6.1 data types ................................................................................................. 2-7 2.6.2 data formats .............................................................................................. 2-8
(2) chapter 3 address space 3.1 outline of address space ................................................................................ 3-2 3.2 operation modes ............................................................................................... 3-6 3.3 internal rom area and extended external area ............................................ 3-8 3.3.1 internal rom area ...................................................................................... 3-8 3.3.2 extended external area .............................................................................. 3-8 3.4 internal ram area and sfr area .................................................................... 3-9 3.4.1 internal ram area ...................................................................................... 3-9 3.4.2 special function register (sfr) area ........................................................ 3-9 3.5 eit vector entry .............................................................................................. 3-28 3.6 icu vector table ............................................................................................. 3-29 3.7 note about address space ............................................................................ 3-31 chapter 4 eit 4.1 outline of eit..................................................................................................... 4-2 4.2 eit event ............................................................................................................ 4-3 4.2.1 exception .................................................................................................... 4-3 4.2.2 interrupt ...................................................................................................... 4-3 4.2.3 trap ............................................................................................................ 4-3 4.3 eit processing procedure ............................................................................... 4-4 4.4 eit processing mechanism ............................................................................. 4-6 4.5 acceptance of eit event .................................................................................. 4-7 4.6 saving and restoring the pc and psw .......................................................... 4-8 4.7 eit vector entry .............................................................................................. 4-10 4.8 exception processing .................................................................................... 4-11 4.8.1 reserved instruction exception (rie) ....................................................... 4-11 4.8.2 address exception (ae) ............................................................................ 4-13 4.9 interrupt processing ....................................................................................... 4-15 4.9.1 reset interrupt (ri) ................................................................................... 4-15 4.9.2 system break interrupt (sbi) .................................................................... 4-16
(3) 4.9.3 external interrupt (ei) ............................................................................... 4-18 4.10 trap processing ............................................................................................ 4-20 4.10.1 trap (trap) ........................................................................................... 4-20 4.11 eit priority levels ......................................................................................... 4-22 4.12 example of eit processing .......................................................................... 4-23 chapter 5 interrupt controller (icu) 5.1 outline of interrupt controller (icu) ................................................................ 5-2 5.2 interrupt sources of internal peripheral i/os ................................................. 5-4 5.3 icu-related registers ...................................................................................... 5-6 5.3.1 interrupt vector register ............................................................................. 5-7 5.3.2 interrupt mask register .............................................................................. 5-8 5.3.3 sbi (system break interrupt) control register ........................................... 5-9 5.3.4 interrupt control registers ........................................................................ 5-10 5.4 icu vector table ............................................................................................. 5-14 5.5 description of interrupt operation ................................................................ 5-17 5.5.1 acceptance of internal peripheral i/o interrupts ....................................... 5-17 5.5.2 processing of internal peripheral i/o interrupts by handlers ................... 5-20 5.6 description of system break interrupt (sbi) operation .............................. 5-22 5.6.1 acceptance of sbi .................................................................................... 5-22 5.6.2 sbi processing by handler ....................................................................... 5-22 chapter 6 internal memory 6.1 outline of the internal memory ........................................................................ 6-2 6.2 internal ram ...................................................................................................... 6-2 6.3 internal flash memory ...................................................................................... 6-2 6.4 registers associated with the internal flash memory .................................. 6-3 6.4.1 flash mode register ................................................................................... 6-4 6.4.2 flash status registers ................................................................................ 6-5 6.4.3 flash controle registers ............................................................................ 6-8
(4) 6.4.4 virtual flash l bank registers ................................................................. 6-14 6.4.5 virtual flash s bank registers ................................................................. 6-15 6.5 programming of the internal flash memory ................................................. 6-16 6.5.1 outline of programming flash memory .................................................... 6-16 6.5.2 controlling operation mode during programming flash .......................... 6-22 6.5.3 programming procedure to the internal flash memory ............................ 6-25 6.5.4 flash write time (for reference) ............................................................. 6-40 6.6 boot rom ........................................................................................................ 6-42 6.7 virtual flash emulation function .................................................................. 6-43 6.7.1 virtual flash emulation area .................................................................... 6-45 6.7.2 entering virtual flash emulation mode .................................................... 6-52 6.7.3 application example of virtual flash emulation mode ............................. 6-53 6.8 connecting to a serial programmer ............................................................. 6-55 6.9 precautions to be taken when rewriting flash memory ........................... 6-57 chapter 7 reset 7.1 outline of reset ................................................................................................ 7-2 7.2 reset operation ................................................................................................ 7-2 7.2.1 reset at power-on ...................................................................................... 7-2 7.2.2 reset during operation ............................................................................... 7-2 7.2.3 reset vector relocation during flash rewrite ........................................... 7-2 7.3 internal state immediately after reset release ............................................. 7-3 7.4 things to be considered after reset release .............................................. 7-4 chapter 8 input/output ports and pin functions 8.1 outline of input/output ports .......................................................................... 8-2 8.2 selecting pin functions ................................................................................... 8-4 8.3 input/output port related registers ............................................................... 8-6 8.3.1 port data registers .................................................................................... 8-8 8.3.2 port direction registers ............................................................................ 8-10 8.3.3 port operation mode registers ................................................................ 8-12
(5) chapter 10 multijunction timers 10.1 outline of multijunction timers ................................................................... 10-2 10.2 common units of multijunction timer ........................................................ 10-9 10.2.1 timer common register map ................................................................. 10-9 10.2.2 prescaler unit ....................................................................................... 10-12 10.2.3 clock bus/input-output event bus control unit ................................... 10-13 8.4 port peripheral circuits .................................................................................. 8-31 chapter 9 dmac 9.1 outline of the dmac ......................................................................................... 9-2 9.2 dmac related registers .................................................................................. 9-4 9.2.1 dma channel control register .................................................................. 9-6 9.2.2 dma software request generation registers ......................................... 9-17 9.2.3 dma source address registers ............................................................... 9-18 9.2.4 dma destination address registers ........................................................ 9-19 9.2.5 dma transfer count registers ................................................................. 9-20 9.2.6 dma interrupt request status registers .................................................. 9-21 9.2.7 dma interrupt mask registers .................................................................. 9-23 9.3 functional description of the dmac ............................................................ 9-27 9.3.1 cause of dma request ............................................................................ 9-27 9.3.2 dma transfer processing procedure ....................................................... 9-31 9.3.3 starting dma ............................................................................................ 9-32 9.3.4 channel priority ........................................................................................ 9-32 9.3.5 gaining and releasing control of the internal bus ................................... 9-32 9.3.6 transfer units ........................................................................................... 9-33 9.3.7 transfer counts ........................................................................................ 9-33 9.3.8 address space ......................................................................................... 9-33 9.3.9 transfer operation .................................................................................... 9-33 9.3.10 end of dma and interrupt ....................................................................... 9-37 9.3.11 status of each register after completion of dma transfer ................... 9-37 9.4 precautions about the dmac ........................................................................ 9-38
(6) 10.2.4 input processing control unit ............................................................... 10-18 10.2.5 output flip-flop control unit ................................................................ 10-26 10.2.6 interrupt control unit ............................................................................ 10-37 10.3 top (output-related 16-bit timer) ............................................................. 10-63 10.3.1 outline of top ...................................................................................... 10-63 10.3.2 outline of each mode of top ............................................................... 10-65 10.3.3 top related register map ................................................................... 10-67 10.3.4 top control registers .......................................................................... 10-70 10.3.5 top counters (top0ct-top10ct) .................................................... 10-77 10.3.6 top reload registers (top0rl-top10rl) ....................................... 10-78 10.3.7 top correction registers (top0cc-top10cc) ................................ 10-79 10.3.8 top enable control register ............................................................... 10-80 10.3.9 operation in top single-shot output mode (with correction function) .. 10-84 10.3.10 operation in top delayed single-shot output mode (with correction function) 10-91 10.3.11 operation in top continuous output mode (without correction function) . 10-96 10.4 tio (input/output-related 16-bit timer) ................................................... 10-100 10.4.1 outline of tio ..................................................................................... 10-100 10.4.2 outline of each mode of tio .............................................................. 10-102 10.4.3 tio related register map .................................................................. 10-105 10.4.4 tio control registers ......................................................................... 10-108 10.4.5 tio counter (tio0ct-tio9ct) .......................................................... 10-119 10.4.6 tio reload 0/ measure register (tio0rl0-tio9rl0) ...................... 10-120 10.4.7 tio reload 1 registers (tio0rl1-tio9rl1) .................................... 10-121 10.4.8 tio enable control registers ............................................................. 10-122 10.4.9 operation in tio measure free-run/clear input modes ..................... 10-125 10.4.10 operation in tio noise processing input mode ................................ 10-129 10.4.11 operation in tio pwm output mode ................................................. 10-130 10.4.12 operation in tio single-shot output mode (without correction function) .. 10-134 10.4.13 operation in tio delayed single-shot output mode (without correction function) .. 10-136 10.4.14 operation in tio continuous output mode (without correction function) . 10-138 10.5 tms (input-related 16-bit timer) .............................................................. 10-140 10.5.1 outline of tms .................................................................................... 10-140 10.5.2 outline of tms operation ................................................................... 10-140
(7) 10.5.3 tms related register map ................................................................ 10-142 10.5.4 tms control registers ....................................................................... 10-143 10.5.5 tms counters (tms0ct, tms1ct) .................................................. 10-145 10.5.6 tms measure registers (tms0mr3-0, tms1mr3-0) ....................... 10-146 10.5.7 operation of tms measure input ....................................................... 10-147 10.6 tml (input-related 32-bit timer) .............................................................. 10-149 10.6.1 outline of tml .................................................................................... 10-149 10.6.2 outline of tml operation ................................................................... 10-150 10.6.3 tml related register map ................................................................. 10-151 10.6.4 tml control registers ........................................................................ 10-152 10.6.5 tml counters ..................................................................................... 10-154 10.6.6 tml measure registers ..................................................................... 10-156 10.6.7 operation of tml measure input ........................................................ 10-158 10.7 tid (input-related 16-bit timer) ................................................................ 10-160 10.7.1 outline of tid ...................................................................................... 10-160 10.7.2 tid related register map .................................................................. 10-162 10.7.3 tid control &prescaler enable registers .......................................... 10-163 10.7.4 tid counters (tid0ct, tid1ct, tid2ct) ......................................... 10-166 10.7.5 tid reload registers (tid0rl, tid1rl, tid2rl) ............................. 10-167 10.7.6 outline of each mode of tid .............................................................. 10-168 10.8 tod (output-related 16-bit timer) ........................................................... 10-173 10.8.1 outline of tod .................................................................................... 10-173 10.8.2 outline of each mode of tod ............................................................. 10-175 10.8.3 tod related register map ................................................................ 10-177 10.8.4 tod control registers (tod0cr) ..................................................... 10-180 10.8.5 tod counters ..................................................................................... 10-182 10.8.6 tod reload 0 registers ..................................................................... 10-184 10.8.7 tod reload 1 registers ..................................................................... 10-186 10.8.8 tod enable protect registers ........................................................... 10-188 10.8.9 tod cout enable registers ............................................................... 10-190 10.8.10 operation in tod pwm output mode .............................................. 10-193 10.8.11 operation in tod single-shot output mode (without correction function) 10-197 10.8.12 operation in tod delayed single-shot output mode (without correction function) 10-199
(8) chapter 11 a-d converters 11.1 outline of a-d converter .............................................................................. 11-2 11.1.1 conversion modes .................................................................................. 11-6 11.1.2 operation modes .................................................................................... 11-7 11.1.3 special operation modes ..................................................................... 11-11 11.1.4 a-d converter interrupt and dma transfer requests .......................... 11-14 11.2 a-d converter related registers .............................................................. 11-15 11.2.1 a-d single mode register 0 ................................................................. 11-19 11.2.2 a-d single mode register 1 ................................................................. 11-23 11.2.3 a-d scan mode register 0 ................................................................... 11-26 11.2.4 a-d scan mode register 1 ................................................................... 11-30 11.2.5 a-d successive approximation register .............................................. 11-33 11.2.6 a-d0 comparate data register ............................................................. 11-35 11.2.7 10-bit a-d data registers ..................................................................... 11-37 11.2.8 8-bit a-d data registers ....................................................................... 11-39 10.8.13 operation in tod continuous output mode (without correction function) . 10-201 10.9 tom (output-related 16-bit timer) .......................................................... 10-203 10.9.1 outline of tom ................................................................................... 10-203 10.9.2 outline of each mode of tom ............................................................ 10-205 10.9.3 tom related register map ................................................................ 10-207 10.9.4 tom control registers ....................................................................... 10-209 10.9.5 tom counters .................................................................................... 10-210 10.9.6 tom reload 0 registers .................................................................... 10-211 10.9.7 tom reload 1 registers .................................................................... 10-212 10.9.8 tom enable protect registers ........................................................... 10-213 10.9.9 tom count enable registers ............................................................. 10-214 10.9.10 operation in tom pwm output mode ............................................... 10-216 10.9.11 operation in tom single-shot output mode (without correction function) 10-220 10.9.12 operation in tom single-shot pwm output mode (without correction function) .... 10-222 10.9.13 operation in tom continuous output mode (without correction function) ... 10-224 10.9.14 example application for using the 32170 in motor control ............... 10-226
(9) 11.3 functional description of a-d converters ............................................... 11-41 11.3.1 how to find along input voltages ........................................................ 11-41 11.3.2 a-d conversion by successive approximation method ....................... 11-42 11.3.3 comparator operation .......................................................................... 11-44 11.3.4 calculation of the a-d conversion time ............................................... 11-45 11.3.5 definition of the a-d conversion accuracy ........................................... 11-48 11.4 precautions on using a-d converters ...................................................... 11-51 chapter 12 serial i/o 12.1 outline of serial i/o ....................................................................................... 12-2 12.2 serial i/o related registers ......................................................................... 12-6 12.2.1 sio interrupt related registers .............................................................. 12-7 12.2.2 sio interrupt control registers .............................................................. 12-9 12.2.3 sio transmit control registers ............................................................ 12-16 12.2.4 sio transmit/receive mode registers ................................................ 12-18 12.2.5 sio transmit buffer registers .............................................................. 12-21 12.2.6 sio receive buffer registers ............................................................... 12-22 12.2.7 sio receive control registers ............................................................. 12-23 12.2.8 sio baud rate registers ..................................................................... 12-26 12.3 transmit operation in csio mode ............................................................ 12-28 12.3.1 setting the csio baud rate ................................................................. 12-28 12.3.2 initial settings for csio transmission .................................................. 12-29 12.3.3 starting csio transmission ................................................................. 12-31 12.3.4 successive csio transmission ........................................................... 12-31 12.3.5 processing at end of csio transmission ............................................ 12-32 12.3.6 transmit interrupt ................................................................................. 12-32 12.3.7 transmit dma transfer request .......................................................... 12-32 12.3.8 typical csio transmit operation ......................................................... 12-34 12.4 receive operation in csio mode .............................................................. 12-36 12.4.1 initial settings for csio reception ....................................................... 12-36 12.4.2 starting csio reception ...................................................................... 12-38 12.4.3 processing at end of csio reception .................................................. 12-38
(10) 12.4.4 about successive reception ................................................................ 12-39 12.4.5 flags indicating the status of csio receive operation ....................... 12-40 12.4.6 typical csio receive operation .......................................................... 12-41 12.5 precautions on using csio mode ............................................................. 12-43 12.6 transmit operation in uart mode ........................................................... 12-45 12.6.1 setting the uart baud rate ................................................................ 12-45 12.6.2 uart transmit/receive data formats ................................................ 12-46 12.6.3 initial settings for uart transmission ................................................. 12-48 12.6.4 starting uart transmission ................................................................ 12-50 12.6.5 successive uart transmission .......................................................... 12-50 12.6.6 processing at end of uart transmission ........................................... 12-51 12.6.7 transmit interrupt ................................................................................. 12-51 12.6.8 transmit dma transfer request .......................................................... 12-51 12.6.9 typical uart transmit operation ........................................................ 12-53 12.7 receive operation in uart mode ............................................................. 12-55 12.7.1 initial settings for uart reception ...................................................... 12-55 12.7.2 starting uart reception ..................................................................... 12-57 12.7.3 processing at end of uart reception ................................................. 12-57 12.7.4 typical uart receive operation ......................................................... 12-59 12.8 fixed period clock output function ......................................................... 12-61 12.9 precautions on using uart mode ............................................................ 12-62 chapter 13 can module 13.1 outline of the can module .......................................................................... 13-2 13.2 can module related registers ................................................................... 13-4 13.2.1 can control register ............................................................................. 13-8 13.2.2 can status register ............................................................................. 13-11 13.2.3 can extended id register ................................................................... 13-15 13.2.4 can configuration register ................................................................. 13-16 13.2.5 can time stamp count register ......................................................... 13-19 13.2.6 can error count registers .................................................................. 13-20 13.2.7 can baud rate prescaler .................................................................... 13-21
(11) 13.2.8 can interrupt related registers .......................................................... 13-22 13.2.9 can mask registers ............................................................................ 13-30 13.2.10 can message slot control registers ................................................. 13-34 13.2.11 can message slots ............................................................................ 13-38 13.3 can protocol ............................................................................................... 13-53 13.3.1 can protocol frame ............................................................................. 13-53 13.4 initializing the can module ........................................................................ 13-56 13.4.1 initialization of the can module ............................................................ 13-56 13.5 transmitting data frames .......................................................................... 13-59 13.5.1 data frame transmit procedure .......................................................... 13-59 13.5.2 data frame transmit operation ........................................................... 13-61 13.5.3 transmit abort function ....................................................................... 13-62 13.6 receiving data frames .............................................................................. 13-63 13.6.1 data frame receive procedure ........................................................... 13-63 13.6.2 data frame receive operation ............................................................ 13-65 13.6.3 reading out received data frames .................................................... 13-67 13.7 transmitting remote frames .................................................................... 13-69 13.7.1 remote frame transmit procedure ..................................................... 13-69 13.7.2 remote frame transmit operation ...................................................... 13-71 13.7.3 reading out received data frames when set for remote frame transmission .. 13-74 13.8 receiving remote frames ......................................................................... 13-76 13.8.1 remote frame receive procedure ...................................................... 13-76 13.8.2 remote frame receive operation ....................................................... 13-78 chapter 14 real-time debugger (rtd) 14.1 outline of the real-time debugger (rtd) .................................................. 14-2 14.2 pin function of the rtd ............................................................................... 14-3 14.3 functional description of the rtd .............................................................. 14-4 14.3.1 outline of rtd operation ....................................................................... 14-4 14.3.2 operation of rdr (real-time ram content output) .............................. 14-5 14.3.3 operation of wrr (ram content forcible rewrite) .............................. 14-7 14.3.4 operation of ver (continuous monitor) ................................................. 14-9
(12) 14.3.5 operation of vei (interrupt request) .................................................... 14-10 14.3.6 operation of rcv (recover from runaway) ........................................ 14-11 14.3.7 method to set a specified address when using the rtd .................... 14-12 14.3.8 resetting the rtd ................................................................................ 14-13 14.4 typical connection with the host ............................................................. 14-14 chapter 15 external bus interface 15.1 external bus interface related signals ...................................................... 15-2 15.2 read/write operations ................................................................................. 15-6 15.3 bus arbitration ............................................................................................ 15-12 15.4 typical connection of external extension memory ................................ 15-14 chapter 16 wait controller 16.1 outline of the wait controller ...................................................................... 16-2 16.2 wait controller related registers ............................................................... 16-4 16.2.1 wait cycles control register .................................................................. 16-5 16.3 typical operation of the wait controller .................................................... 16-6 chapter 17 ram backup mode 17.1 outline ............................................................................................................ 17-2 17.2 example of ram backup when power is down ......................................... 17-2 17.2.1 normal operating state .......................................................................... 17-3 17.2.2 ram backup state ................................................................................. 17-4 17.3 example of ram backup for saving power consumption ....................... 17-5 17.3.1 normal operating state .......................................................................... 17-6 17.3.2 ram backup state ................................................................................. 17-7 17.3.3 precautions to be observed at power-on .............................................. 17-8 17.4 exiting ram backup mode (wakeup) ......................................................... 17-9
(13) chapter 18 oscillation circuit 18.1 oscillator circuit ........................................................................................... 18-2 18.1.1 example of an oscillator circuit .............................................................. 18-2 18.1.2 system clock output function ............................................................... 18-3 18.1.3 oscillation stabilization time at power-on ............................................. 18-4 18.2 clock generator circuit ................................................................................ 18-5 chapter 19 jtag 19.1 outline of jtag ............................................................................................. 19-2 19.2 configuration of the jtag circuit ............................................................... 19-3 19.3 jtag registers ............................................................................................. 19-4 19.3.1 instruction register (jtagir) ................................................................. 19-4 19.3.2 data registers ........................................................................................ 19-5 19.4 basic operation of jtag ............................................................................. 19-6 19.4.1 outline of jtag operation ..................................................................... 19-6 19.4.2 ir path sequence ................................................................................... 19-8 19.4.3 dr path sequence ............................................................................... 19-10 19.4.4 examining and setting data registers ................................................. 19-12 19.5 boundary scan description language ..................................................... 19-14 19.6 precautions about board design when connecting jtag ..................... 19-34 chapter 20 power-up/power-shutdown sequence 20.1 configuration of the power supply circuit ................................................ 20-2 20.2 power-on sequence ..................................................................................... 20-3 20.2.1 power-on sequence when not using ram backup ............................. 20-3 20.2.2 power-on sequence when using ram backup .................................... 20-4 20.3 power-shutdown sequence ......................................................................... 20-5 20.3.1 power-shutdown sequence when not using ram backup .................. 20-5 20.3.2 power-shutdown sequence when using ram backup ......................... 20-6
(14) chapter 21 electrical characteristics 21.1 absolute maximum ratings ......................................................................... 21-2 21.2 recommended operating conditions ........................................................ 21-3 21.3 dc characteristics ........................................................................................ 21-5 21.3.1 electrical characteristics ........................................................................ 21-5 21.3.2 flash related electrical characteristics ............................................... 21-10 21.4 a-d conversion characteristics ................................................................ 21-11 21.5 ac characteristics ...................................................................................... 21-12 21.5.1 timing requirements ............................................................................ 21-12 21.5.2 switching characteristics ...................................................................... 21-15 21.5.3 ac characteristics ................................................................................ 21-18 chapter 22 typical characteristics 22.1 a-d conversion characteristics .................................................................. 22-2 appendix 1 mechanical specifications appendix 1.1 dimensional outline drawing ....................................... appendix 1-2 appendix 2 instruction processing time appendix 2.1 32170 instruction processing time ............................. appendix 2-2 appendix 3 precautions about noise appendix 3.1 precautions about noise .............................................. appendix 3-2 appendix 3.1.1 reduction of wiring length ........................................ appendix 3-2 appendix 3.1.2 inserting a bypass capacitor between vss and vcc lines ...... appendix 3-4 appendix 3.1.3 processing analog input pin wiring ........................... appendix 3-5 appendix 3.1.4 consideration about the oscillator .............................. appendix 3-6 appendix 3.1.5 processing input/output ports .................................... appendix 3-8
chapter 1 chapter 1 overview 1.1 outline of the 32170 1.2 block diagram 1.3 pin function 1.4 pin layout
1 1-2 ver.0.10 1.1 outline of the 32170 1.1.1 m32r family cpu core (1) based on risc architecture ? the 32170 is a 32-bit risc single-chip microcomputer which is built around the m32r family cpu core (hereafter referred to as the m32r) and incorporates flash memory, ram, and various other peripheral functions-all integrated into a single chip. ? the m32r is based on risc architecture. memory access is performed using load and store instructions, and various arithmetic operations are executed using register-to-register operation instructions. the m32r internally contains sixteen 32-bit general-purpose registers and has 83 distinct instructions. ? the m32r supports compound instructions such as load & address update and store & address update, in addition to ordinary load and store instructions. these compound instructions help to speed up data transfers. (2) 5-stage pipelined processing ? the m32r uses 5-stage pipelined instruction processing consisting of instruction fetch, decode, execute, memory access, and write back. not just load and store instructions or register-to-register operation instructions, compound instructions such as load & address update and store & address update also are executed in one cycle. ? instructions are entered into the execution stage in the order they are fetched, but this does not always mean that the first instruction entered is executed first. if the execution of a load or store instruction entered earlier is delayed by one or more wait cycles inserted in memory access, a register-to-register operation instruction entered later may be executed before said load or store instruction. by using "out-of-order-completion" like this, the m32r controls instruction execution without wasting clock cycles. (3) compact instruction code ? the m32r instructions come in two types: one consisting of 16 bits in length, and the other consisting of 32 bits in length. use of the 16-bit length instruction format especially helps to suppress the program code size. ? some 32-bit long instructions can branch directly to a location 32 mbytes forward or backward from the instruction address being executed. compared to architectures where address space is segmented, this direct jump allows for easy programming. overview 1.1 outline of the 32170
1 1-3 ver.0.10 overview 1.1 outline of the 32170 1.1.2 built-in multiply-accumulate operation function (1) built-in high-speed multiplier ? the m32r incorporates a 32-bit 16-bit high-speed multiplier which enables it to execute a 32-bit 32-bit integral multiplication instruction in three cycles (1 cycle = 25 ns when using a 40 mhz internal cpu clock). (2) supports multiply-accumulate operation instructions comparable to dsp ? the m32r supports the following four modes of multiply-accumulate operation instructions (or multiplication instructions) using a 56-bit accumulator. any of these operations can be executed in one cycle. ? 16 high-order register bits 16 high-order register bits 16 low-order register bits 16 low-order register bits a entire 32 register bits 16 high-order register bits ? entire 32 register bits 16 low-order register bits the m32r has instructions to round off the value stored in the accumulator to 16 or 32 bits, as well as instructions to shift the accumulator value to adjust digits and store the digit-adjusted value in a register. these instructions also can be executed in one cycle, so that when combined with high-speed data transfer instructions such as load & address update and store & address update, they enable the m32r to exhibit high data processing capability comparable to that of dsp. 1.1.3 built-in flash memory and ram ? the 32170 contains flash memory and ram which can be accessed with no wait states, allowing you to build a high-speed embedded system. ? the internal flash memory allows for on-board programming (you can write to it while being mounted on the printed circuit board). use of flash memory means the chip engineered at the development phase can be used directly in mass-production, so that you can smoothly migrate from prototype to mass-production without changing the printed circuit board. ? the internal flash memory can be rewritten 100 times. ? the internal flash memory has a pseudo-flash emulation function, allowing the internal ram to be artificially mapped into part of the internal flash memory. this function, when combined with the internal real-time debugger (rtd), facilitates data tuning on rom tables. ? the internal ram can be accessed for read or rewrite from an external device independently of the m32r by using rtd (real-time debugger). it is communicated with external devices by rtd's exclusive clock-synchronized serial i/o.
1 1-4 ver.0.10 overview 1.1 outline of the 32170 1.1.4 built-in clock frequency multiplier ? the 32170 internally multiplies the input clock signal frequency by 4 and the internal peripheral clock by 2. if the input clock frequency is 10.0 mhz, the cpu clock frequency will be 40 mhz and the internal clock frequency 20 mhz. 1.1.5 built-in powerful peripheral functions (1) built-in multijunction timer (mjt) ? the multijunction timer is configured with the following timers: ? 16-bit output-related timer 35 channels 16-bit input/output-related timer 10 channels a 16-bit input-related timer 11 channels (incorporating three channels of multiply-by-4 counter) ? 32-bit input-related timer 8 channels each timer has multiple modes of operation, which can be selected according of the purpose of use. the multijunction timer has internal clock bus, input event bus, and output event bus, allowing multiple timers to be combined for use internally. this provides a flexible way to make use of timer functions. the output-related timers (top) have a correction function. this function allows the timer's count value in progress to be increased or reduced as desired, thus materializing real-time output control. (2) built-in 10-channel dma ? the 10-channel dma is built-in, supporting data transfers between internal peripheral i/os or between internal peripheral i/o and internal ram. not only can dma transfer requests be generated in software, but can also be triggered by a signal generated by an internal peripheral i/o (e.g., a-d converter, mjt, or serial i/o). ? cascaded connection between dma channels (dma transfer in a channel is started by completion of transfer in another) is also supported, allowing for high-speed transfer processing without imposing any extra load on the cpu. (3) built-in 16-channel a-d converters ? the 32170 contains two 16-channel a-d converters which can convert data in 10-bit resolution. in addition to single a-d conversion in each channel, successive a-d conversion in four, eight, or 16 channels combined into one unit is possible. ? in addition to ordinary a-d conversion, a comparator mode is supported in which the a-d conversion result is compared with a given set value to determine the relative magnitudes of two quantities. ? when a-d conversion is completed, the 32170 can generate not only an interrupt, but can also generate a dma transfer request. ? the 32170 supports two read out modes, so that a-d conversion results can be read out in 8 bits or 10 bits.
1 1-5 ver.0.10 overview 1.1 outline of the 32170 (4) high-speed serial i/o ? the 32170 incorporates 6 channels of serial i/o, which can be set for clock-synchronized serial i/o or uart. ? when set for clock-synchronized serial i/o, the data transfer rate is a high 2 mbits per second. ? when data reception is completed or the transmit buffer becomes empty, the serial i/o can generate a dma transfer request signal. (5) built-in real-time debugger (rtd) ? the real-time debugger (rtd) provides a function for the m32r/e's internal ram to be accessed directly from an external device. the debugger communicates with external devices through its exclusive clock-synchronized serial i/o. ? by using the rtd, you can read the contents of the internal ram or rewrite its data from an external device independently of the m32r. ? the debugger can generate an rtd interrupt to notify that rtd-based data transmission or reception is completed. (6) eight-level interrupt controller ? the interrupt controller manages interrupt requests from each internal peripheral i/o by resolving interrupt priority in eight levels including an interrupt-disabled state. also, it can accept external interrupt requests due to power-down detection or generated by a watchdog timer as a system break interrupt (sbi). (7) three operation modes ? the m32r/e has three operation modes-single-chip mode, extended external mode, and processor mode. the address space and external pin functions of the m32r/e are switched over according to a mode in which it operates. the mod0 and mod1 pins are used to set a mode. (8) wait controller ? the wait controller supports access to external devices by the m32r. in all but single-chip mode, the extended external area provides 4 mbytes of space.
1 1-6 ver.0.10 1.1.6 built-in full-can function ? the 32170 contains can specification v2.0b-compliant can module, thereby providing 16 message slots. 1.1.7 built-in debug function ? the 32170 supports jtag interface. boundary scan test can be performed using this jtag interface. overview 1.1 outline of the 32170
1 1-7 ver.0.10 overview 1.2 block diagram 1.2 block diagram figure 1.2.1 shows a block diagram of the 32170. features of each block are shown in tables 1.2.1 through 1.2.3. figure 1.2.1 block diagram of the 32170 pll clock generator circuit internal bus interface address data internal ram (m32170f6:40kb) (m32170f4:32kb) (m32170f3:32kb) internal flash memory (m32170f6:768kb) (m32170f4:512kb) (m32170f3:384kb) m32r cpu core (max 40mhz) multiplier- accumulator (32 x 16 + 56) dmac (10 channels) multijunction timer (mjt: 64 channels) serial i/o (6 channels) a-d converter (10-bit resolution, 16 channels) x 2 wait controller interrupt controller (31 sources, 8 levels) real-time debugger (rtd) external bus interface internal 16-bit bus internal 32-bit bus input/output port (jtag), 157 lines full can (1 channel) 32170
1 1-8 ver.0.10 overview 1.2 block diagram table 1.2.1 features of the m32r family cpu core functional block features m32r family ? bus specifications cpu core basic bus cycle: 25 ns (when operating with 40 mhz cpu clock) logical address space: 4gbytes, linear extended external area: maximum 4 mbytes external data bus: 16 bits ? implementation: five-stage pipeline ? internal 32-bit architecture for the core ? register configuration general-purpose register: 32 bits 16 registers control register: 32 bits 5 registers instruction set 16-bit and 32-bit instruction formats 83 distinct instructions and 9 addressing modes built-in multiplier/accumulator (32 16 + 56) table 1.2.2 features of internal memory functional block features ram ? capacity m32170f6 : 40 kbytes m32170f4, m32170f3 : 32 kbytes ? no-wait access (when operating with 40 mhz cpu clock) ? by using rtd (real-time debugger), the internal ram can be accessed for read or rewrite from external devices independently of the m32r. flash memory ? capacity m32170f6 : 768 kbytes m32170f4 : 512 kbytes m32170f3 : 384 kbytes ? no-wait access (when operating with 40 mhz cpu clock) ? durability: can be rewritten 100 times
1 1-9 ver.0.10 table 1.2.3 features of internal peripheral i/o functional block features dma ? 10-channel dma ? supports transfer between internal peripheral i/os and between internal peripheral i/o and internal ram. ? capable of advanced dma transfer when operating in combination with internal peripheral i/o ? capable of cascaded connection between dma channels (dma transfer in a channel is started by completion of transfer in another) multijunction ? 64-channel multifunction timer ? contains output-related timer 35 channels, input/output-related timer 10 channels, 16-bit input-related timer 11 channels, and 32-bit input-related timer 8 channels. capable of flexible timer configuration by mutual connection between each channel. a-d converter 16-channel, 10-bit resolution a-d converter 2 units incorporates comparator mode can generate interrupt or start dma transfer upon completion of a-d conversion. can read out conversion results in 8 or 10 bits. serial i/o 6-channel serial i/o can be set for clock-synchronized serial i/o or uart. capable of high-speed data transfer at 2 mbits per second when clock synchronized or 156 kbits per second during uart. real-time debugger can rewrite or monitor the internal ram independently of the cpu by command input from an external source. has its exclusive clock-synchronized serial port. interrupt controller accepts and manages interrupt requests from internal peripheral i/o. resolves interrupt priority in 8 levels including interrupt-disabled state. wait controller controls wait state for access to extended external areas. can insert 1 to 4 wait cycles by setting in software and extend wait period by external wait signal. clock pll multiply-by-4 clock generator circuit maximum 40 mhz of cpu clock (cpu, internal rom, internal ram access) maximum 20 mhz of internal peripheral clock (peripheral module access) maximum external input clock frequency=10 mhz can sixteen message slots jtag capable of boundary scan overview 1.2 block diagram
1 1-10 ver.0.10 overview 1.3 pin function 1.3 pin function figure 1.3.1 shows a pin function diagram of the 32170 in 240qfp package. figure 1.3.2 shows a pin function diagram of the 32170 in 255fbga package. table 1.3.1 explains the function of each pin of the 32170. table 1.3.2 explains the function of the dedicated debug pins of the 32170 in 255fbga package. figure 1.3.1 pin function diagram of 240qfp xin reset m32170f6vfp , m32170f4vfp , m32170f3vfp clock reset vcci vss 6 16 p20 ? p27/a23 ? a30 p30 ? p37/a15 ? a22 p46, p47/a13, a14 address bus 20 p00 ? p07/db0 ? db7 p10 ? p17/db8 ? db15 data bus 16 p72/hreq p73/hack bus control p71/wait interrupt controller p43/rd p44/cs0 p45/cs1 p41/blw/ble p42/bhw/bhe port 22 port 2 port 3 port 4 port 0 port 1 port 7 port 4 xout vcnt osc-vcc osc-vss mod0 mod1 mode p190 ? p197/tin26 ? tin33 p172, p173/tin24, tin25 p150 ? p157/tin0 ? tin7 p140 ? p147/tin8 ? tin15 p130 ? p137/tin16 ? tin23 34 port 19 port 17 port 15 port 14 port 13 p124 ? p127/ tclk0 ? tclk 3 4 multi- junction timer 45 p210 - p217/to37 - to44 p180 - p187/to29 - to36 p160 - p167/to21 - to28 p110 - p117/to0 - to7 p100 - p107/to8 - to15 p93 - p97/to16 - to20 port 12 port 21 port 18 port 16 port 11 port 10 port 9 p74/rtdtxd p75/rtdrxd p76/rtdack p77/rtdclk real-time debugger port 7 p70/bclk/wr port 7 p82/txd0 p83/rxd0 p84/sclki0/sclko0 p85/txd1 p86/rxd1 p87/sclki1/sclko1 serial i/o port 8 16 ad1in0 ? ad1in15 a-d converter p67/adtrg avcc0, avcc1 avss0, avss1 port 6 p61-p63 port 6 avref0, avref1 vdd fvcc fp vcce 7 p174/txd2 p175/rxd2 p176/txd3 p177/rxd3 port 17 3.3v 5v 3.3v 5v 3.3v 3.3v 5v note1. : denotes blocks operating with a 3.3 v power supply. : denotes blocks operating with a 5 v power supply. 16 ad0in0 ? ad0in15 2 2 2 p200/txd4 p201/rxd4 p202/txd5 p203/rxd5 port 20 p220/ctx p221/crx can jtms jtck jtrst jtdo jtag jtdi port 22 p222, p223 port 22 p224/a11(note2) p225/a12(note2) note2. use caution when using this port because it has a debug event function. p65/sclki4/sclko4 p64/sbi port 6 p66/sclki5/sclko5 port 6 3
1 1-11 ver.0.10 overview 1.3 pin function figure 1.3.2 pin function diagram of 255fbga xin reset m32170f6vwg , M32170F4VWG , m32170f3 vwg clock reset vcci vss 6 16 p20 p27/a23 a30 p30 p37/a15 a22 p46, p47/a13, a14 address bus 20 p00 p07/db0 db7 p10 p17/db8 db15 data bus 16 p72/hreq p73/hack bus control p71/wait interrupt controller p43/rd p44/cs0 p45/cs1 p41/blw/ble p42/bhw/bhe port 22 port 2 port 3 port 4 port 0 port 1 port 7 port 4 xout vcnt osc-vcc osc-vss mod0 mod1 mode p190 p197/tin26 tin33 p172, p173/tin24, tin25 p150 p157/tin0 tin7 p140 p147/tin8 tin15 p130 p137/tin16 tin23 34 port 19 port 17 port 15 port 14 port 13 p124 p127/ tclk0 tclk 3 4 multi- junction timer 45 p210 p217/to37 to44 p180 p187/to29 to36 p160 p167/to21 to28 p110 p117/to0 to7 p100 p107/to8 to15 p93 p97/to16 to20 port 12 port 21 port 18 port 16 port 11 port 10 port 9 p74/rtdtxd p75/rtdrxd p76/rtdack p77/rtdclk real-time debugger port 7 p70/bclk/wr port 7 p82/txd0 p83/rxd0 p84/sclki0/sclko0 p85/txd1 p86/rxd1 p87/sclki1/sclko1 serial i/o port 8 16 ad1in0 ad1in15 a-d converter p67/adtrg avcc0, avcc1 avss0, avss1 port 6 p61 p63 port 6 avref0, avref1 vdd fvcc fp vcce 7 p174/txd2 p175/rxd2 p176/txd3 p177/rxd3 port17 3.3v 5v 3.3v 5v 3.3v 3.3v 5v note1. : denotes blocks operating with a 3.3 v power supply : denotes blocks operating with a 5 v power supply. 16 ad0in0 ad0in15 2 2 2 p200/txd4 p201/rxd4 p202/txd5 p203/rxd5 port 20 p220/ctx p221/crx can jtms jtck jtrst jtdo jtag jtdi port 22 p222, p223 port 22 p224/a11 (note2) p225/a12 (note2) note2. use caution when using this port because it has a debug event function. p65/sclki4/sclko4 p64/sbi port 6 p66/sclki5/sclko5 port 6 3 8 trclk trsync trdata jdbi jevento jevent1 dbgug note3. 255fbga is currently under development.
1 1-12 ver.0.10 table 1.3.1 description of the 32170 pin function (1/6) type pin name signal name input/output function power vcce power supply power supply to external i/o ports (5 v). supply vcci power supply power supply to internal logic (3.3 v). vdd ram power supply power supply for internal ram backup (3.3 v). fvcc flash power supply power supply for internal flash memory (3.3 v). vss ground connect all vss to ground (gnd). clock xin, clock input clock input/output pins. these pins contains a pll-based xout output frequency multiplier circuit. apply a clock whose frequency is 1/4 the operating frequency. (when using 40 mhz cpu clock, xin input = 10.0 mhz) bclk/wr system clock output this pin outputs a clock whose frequency is twice that of external input clock. (when using 10 mhz external input clock, bclk output = 20 mhz). use this output when external operation needs to be synchronized. osc-vcc power supply power supply for pll circuit. connect osc-vcc to the power supply rail. osc-vss ground connect osc-vss to ground. vcnt pll control input this pin controls the pll circuit. connect a resistor and capacitor to it. (for external circuits, refer to section 18.1.1, "example of an oscillator circuit.") reset reset reset input this pin resets the internal circuit. mode mod0 mode input these pins set operation mode. mod1 mod0 mod1 mode 0 0 single-chip mode 0 1 extended external mode 1 0 processor mode 0 0 (boot mode) (note) 1 1 (reserved) address a11 C a30 address output the device has 20 address lines (a11-a30) to allow two bus bus channels of up to 2 mb of memory space to be added external to the chip. a31 is not output. note: for boot mode, refer to chapter 6, "internal memory." overview 1.3 pin function
1 1-13 ver.0.10 table 1.3.1 description of the 32170 pin function (2/6) type pin name signal name input/output function data db0-db15 data bus input/output these pins comprise 16-bit data bus to connect external devices. in write bus cycles, the valid byte positions to be written on the 16-bit data bus are output as bhw/bhe and blw/ble. in read cycles, data is always read from the 16-bit data bus. however, when transferring to the internal circuit of the m32r, only data at the valid byte positions are transferred. bus ___ cs0, chip select output these pins comprise external device chip select signal. for control ___ cs1 areas for which a chip select signal is output, refer to chapter 3, "address space." __ rd read output this signal is output when reading an external device. ___ ___ bhw/bhe byte high output indicates the byte position to which valid data is transferred write/enable ___ ___ when writing to an external device. bhw/bhe corresponds ___ ___ blw/ble byte low output ___ ___ to the upper address (d0-d7 is valid); blw/ble write/enable corresponds to the lower address (d8-d15 is valid). ____ wait wait input when the m32r accesses an external device, a low on this ____ wait input extends the wait cycle. ____ hreq hold request input this pin is used by an external device to request control of ____ the external bus. a low on this hreq input causes the m32r to enter a hold state. ____ hack hold output this signal is used to notify that the m32r has entered a acknowledge hold state and relinquished control of the external bus. tin 0Ctin 33 timer input input input pins for multijunction timer. to 0C to 44 timer output output output pins for the multijunction timer. tclk 0C tclk 3 timer clock input clock input pins for the multijunction timer. a-d avcc0, analog power supply avcc0 is the power supply for the a-d0 converter. avcc1 converter avcc1 is the power supply for the a-d1 converter. connect avcc0 and 1 to the power supply rail. avss0, analog ground avss0 is analog ground for the a-d0 converter. avss1 is avss1 analog ground for the a-d1 converter. connect avss0 and 1 to the ground. ad0in0 analog input input 16-channel analog input pins for the a-d0 converter. C ad0in15 ad1in0 16-channel analog input pins for the a-d1 converter. C ad1in15 overview 1.3 pin function multi- junction timer
1 1-14 ver.0.10 table 1.3.1 description of the 32170 pin function (3/6) type pin name signal name input/output function a-d vref0, reference input vref0 is the reference voltage input pin for the a-d0 converter. converter vref1 voltage input vref1 is the reference voltage input pin for the a-d1 converter. _____ adtrg conversion input hardware trigger input pin to start a-d conversion. trigger interrupt ___ sbi system break input system break interrupt (sbi) input pin for the interrupt controller interrupt controller serial i/o sclki0 / uart transmit/ input/output when channel 0 is in uart mode: sclko0 receive clock this pin outputs a clock derived from brg output by halving it . output or csio transmit/receive when channel 0 is in csio mode: clock input/output this pin accepts as its input a transmit/receive clock when external clock source is selected or outputs a transmit/receive clock when internal clock source is selected. sclki1 / uart transmit/ input/output when channel 1 is in uart mode: sclko1 receive clock this pin outputs a clock derived from brg output by halving it . output or csio transmit/receive when channel 1 is in csio mode: clock input/output this pin accepts as its input a transmit/receive clock when external clock source is selected or outputs a transmit/receive clock when internal clock source is selected. sclki4 / uart transmit/ input/output when channel 4 is in uart mode: sclko4 receive clock this pin outputs a clock derived from brg output by halving it . output or csio transmit/receive when channel 4 is in csio mode: clock input/output this pin accepts as its input a transmit/receive clock when external clock source is selected or outputs a transmit/receive clock when internal clock source is selected. sclki5 / uart transmit/ input/output when channel 5 is in uart mode: sclko5 receive clock this pin outputs a clock derived from brg output by halving it . output or csio transmit/receive when channel 5 is in csio mode: clock input/output this pin accepts as its input a transmit/receive clock when external clock source is selected or outputs a transmit/receive clock when internal clock source is selected. txd0 transmit data output transmit data output pin for serial i/o channel 0 rxd0 receive data input receive data input pin for serial i/o channel 0 overview 1.3 pin function
1 1-15 ver.0.10 real-time debugger txd1 transmit data output transmit data output pin for serial i/o channel 1. rxd1 receive data input receive data input pin for serial i/o channel 1. txd2 transmit data output transmit data output pin for serial i/o channel 2. rxd2 receive data input receive data input pin for serial i/o channel 2. txd3 transmit data output transmit data output pin for serial i/o channel 3. rxd3 receive data input receive data input pin for serial i/o channel 3. txd4 transmit data output transmit data output pin for serial i/o channel 4. rxd4 receive data input receive data input pin for serial i/o channel 4. txd5 transmit data output transmit data output pin for serial i/o channel 5. rxd5 receive data input receive data input pin for serial i/o channel 5. rtdtxd transmit data output serial data output pin for the real-time debugger. rtdrxd receive data input serial data input pin for the real-time debugger. rtdclk clock input input serial data transmit/receive clock input pin for the real-time debugger. rtdack acknowledge output this pin outputs a low pulse synchronously with the beginning clock of the real-time debugger's serial data output word. the duration of this low pulse indicates the type of command/data that the real-time debugger has received. flash fp flash protect input this mode pin has a function to protect the flash -only memory against e/w in hardware. can ctx data output output this pin outputs data from the can module. crx data input input this pin is used to input data to the can module. jtag jtms test mode input test mode select input to control state transition of the test circuit. jtck clock input clock input for the debug module and test circuit. jtrst test reset input test reset input to initialize the test circuit asynchronously. jtdi serial input input this pin is used to input test instruction code or test data serially. jtdo serial output output this pin outputs test instruction code or test data serially. overview 1.3 pin function table 1.3.1 description of the 32170 pin function (4/6) type pin name signal name input/output function
1 1-16 ver.0.10 overview 1.3 pin function table 1.3.1 description of the 32170 pin function (5/6) type pin name signal name input/output function p00 C p07 input/output input/output programmable input/output port. port 0 p10 C p17 input/output input/output programmable input/output port. port 1 p20 C p27 input/output input/output programmable input/output port. port 2 p30 C p37 input/output input/output programmable input/output port. port 3 p41 C p47 input/output input/output programmable input/output port. port 4 p61 C p67 input/output input/output programmable input/output port. port 6 (however, p64 is an input-only port.) p70 C p77 input/output input/output programmable input/output port. port 7 p82 C p87 input/output input/output programmable input/output port. port 8 p93 C p97 input/output input/output programmable input/output port. port 9 p100 input/output input/output programmable input/output port. C p107 port 10 p110 input/output input/output programmable input/output port. C p117 port 11 p124 input/output input/output programmable input/output port. C p127 port 12 p130 input/output input/output programmable input/output port. C p137 port 13 p140 input/output input/output programmable input/output port. C p147 port 14 p150 input/output input/output programmable input/output port. C p157 port 15 p160 input/output input/output programmable input/output port. C p167 port 16 input/ output port (note) note: input/output port 5 is reserved for future use.
1 1-17 ver.0.10 p172 input/output input/output programmable input/output port. C p177 port 17 p180 input/output input/output programmable input/output port. C p187 port 18 p190 input/output input/output programmable input/output port. C p197 port 19 p200 input/output input/output programmable input/output port. C p203 port 20 p210 input/output input/output programmable input/output port. C p217 port 21 p220 input/output input/output programmable input/output port. (note) C p225 port 22 (however, p221 is an input only port.) note: use caution when using p224 and p225 because they have a debug event function. table 1.3.2 description of the debug-only pin function of 255fbga type pin name signal name input/output function debog jdbi debug interrupt input debug interrupt request input pin. a low on this input request requests a debug interrupt. jevent0, event output output output synchronously with trclk. when an event occurs, jevent1 this output is driven high for a 1 trclk period. trclk trace clock output clock output pin for trace operation. trace data is output output synchronously with this clock. trsync trace packet output this is a trace packet output start signal. when the device output start signal starts outputting a trace packet, this signal is driven high for a 1 trclk period. trdata0 trace packet output trace packet output pin. - trdata7 output note: 255fbga is currently under development. table 1.3.1 description of the 32170 pin function (6/6) type pin name signal name input/output function input/ output port overview 1.3 pin function
1 1-18 ver.0.10 overview 1.4 pin layout 1.4 pin layout figure 1.4.1 shows a pin layout diagram of the 32170 in 240qfp package. figure 1.4.2 shows a pin layout diagram of the 32170 in 255fbga package. table 1.4.1 lists pin assignments of the 240qfp. table 1.4.2 lists pin assignments of the 255fbga. figure 1.4.1 pin layout diagram of the 240qfp (top view) package: 240p6y-a (0.5 mm pitch) note: use caution when using these pins because they have a debug event function. m32170f3vfp m32170f4vfp m32170f6vfp 2 4 3 44 43 5 6 7 8 9 35 36 37 38 39 40 22 23 24 25 26 27 28 29 30 31 32 33 34 11 12 13 14 15 16 17 18 19 20 21 41 42 10 1 60 59 51 52 53 54 55 56 45 46 47 48 49 50 57 58 89 90 99 98 97 96 95 94 93 92 91 103 102 101 112 111 110 109 108 107 106 105 104 120 119 118 117 116 115 114 113 63 64 66 67 68 69 70 71 72 73 74 65 84 75 76 77 78 79 80 81 82 83 85 86 87 88 61 62 100 124 132 130 129 127 121 137 146 145 144 143 142 141 140 139 138 155 154 153 152 151 150 149 148 147 156 159 158 157 133 136 135 134 123 122 131 128 126 125 166 165 164 163 162 161 175 174 173 172 171 170 169 168 167 176 179 178 177 160 180 195 185 184 183 182 181 186 189 188 187 194 193 192 191 190 196 199 198 197 205 204 203 202 201 200 206 209 208 207 215 214 213 212 211 210 216 239 217 219 218 225 224 223 222 221 220 226 227 229 228 230 235 234 233 232 231 236 237 238 240 p41/blw/ble p157/tin7 p156/tin6 p155/tin5 p154/tin4 p153/tin3 p152/tin2 p151/tin1 p150/tin0 p147/tin15 p146/tin14 p145/tin13 p144/tin12 p143/tin11 p142/tin10 p141/tin9 p140/tin8 vss vcce p137/tin23 p136/tin22 p135/tin21 p134/tin20 p133/tin19 p132/tin18 p131/tin17 p130/tin16 vss vcci p42/bhw/bhe p127/tclk3 p126/tclk2 p125/tclk1 p124/tclk0 p107/to15 p106/to14 p105/to13 p104/to12 vss vcci p103/to11 vss vcci p43/rd p44/cs0 p45/cs1 p14/db12 p37/a22 p36/a21 p33/a18 p31/a16 p30/a15 p35/a20 p34/a19 p32/a17 vcce p27/a30 p25/a28 p26/a29 p24/a27 p07/db7 p02/db2 p01/db1 p00/db0 p23/a26 p22/a25 p20/a23 p10/db8 p11/db9 vss p15/db13 p13/db11 p12/db10 p06/db6 p04/db4 p03/db3 p47/a14 p21/a24 p46/a13 vcce vss p16/db14 p17/db15 p82/txd0 vss vcce p172/tin24 p173/tin25 p174/txd2 p175/rxd2 p176/txd3 p177/rxd3 p160/to21 p161/to22 p162/to23 p163/to24 p164/to25 p165/to26 p166/to27 p167/to28 vss vcci vref0 avcc0 ad0in7 ad0in6 ad0in5 ad0in4 ad0in3 ad0in2 ad0in1 ad0in0 ad0in15 ad0in14 ad0in13 ad0in12 ad0in11 ad0in10 ad0in9 ad0in8 avss0 p181/to30 p182/to31 p183/to32 p184/to33 p180/to29 vss vcce p186/to35 p187/to36 p190/tin26 p185/to34 p194/tin30 p195/tin31 p196/tin32 p197/tin33 p191/tin27 p192/tin28 p193/tin29 reset p84/sclki0/sclko0 p83/rxd0 p85/txd1 p86/rxd1 p87/sclki1/sclko1 vss vcce vcci p62 vss fp p67/adtrg p66/sclki5/sclko5 p65/sclki4/sclko4 p94/to17 p74/rtdtxd p75/rtdrxd p76/rtdack p77/rtdclk p61 p63 p114/to4 p115/to5 p116/to6 p117/to7 vss vcce mod1 p100/to8 p101/to9 p102/to10 p110/to0 p111/to1 p112/to2 p113/to3 p95/to18 p96/to19 p97/to20 p70/bclk/wr p71/wait p72/ hreq p64/sbi mod0 p93/to16 p73/ hack vcci vss vdd fvcc p201/rxd4 p202/txd5 p203/rxd5 p200/txd4 ad1in5 ad1in4 ad1in3 ad1in2 ad1in1 ad1in0 vref1 ad1in15 ad1in14 ad1in13 ad1in12 avss1 ad1in6 jtdo jtrst jtck jtms jtdi p212/to39 p213/to40 p214/to41 p215/to42 p211/to38 p210/to37 p216/to43 p217/to44 vcnt osc-vcc xout xin osc-vss p221/crx p220/ctx vss vss p05/db5 ad1in11 ad1in10 ad1in9 ad1in8 ad1in7 p222 p223 (note) p224/a11 (note) p225/a12 vss avcc1
1 1-19 ver.0.10 overview 1.4 pin layout table 1.4.1 pin assignments of the 240qfp (1/2) no. pin name no. pin name no. pin name no. pin name 1 ad1in12 41 p26 / a29 81 vss 121 p87 / sclki1 / sclko1 2 ad1in13 42 p27 / a30 82 p180 / to29 122 p200 / txd4 3 ad1in14 43 p00 / db0 83 p181 / to30 123 p201 / rxd4 4 ad1in15 44 p01 / db1 84 p182 / to31 124 p202 / txd5 5 avss1 45 p02 / db2 85 p183 / to32 125 p203 / rxd5 6 __ p43 / rd 46 p03 / db3 86 p184 / to33 126 vcci 7 ___ p44 / cs0 47 p04 / db4 87 p185 / to34 127 vss 8 ___ p45 / cs1 48 p05 / db5 88 p186 / to35 128 fvcc 9 p46 / a13 49 p06 / db6 89 p187 / to36 129 vss 10 p47 / a14 50 p07 / db7 90 p190 / tin26 130 p61 11 p220 / ctx 51 vcce 91 p191 / tin27 131 p62 12 p221 / crx 52 vss 92 p192 / tin28 132 p63 13 p222 53 p10 / db8 93 p193 / tin29 133 ___ p64 / sbi 14 p223 54 p11 / db9 94 p194 / tin30 134 p65 / sclki4 / sclko4 15 p224 / a11 55 p12 / db10 95 p195 / tin31 135 p66 / sclki5 / sclko5 16 p225 / a12 56 p13 / db11 96 p196 / tin32 136 _____ p67 / adtrg 17 vss 57 p14 / db12 97 p197 / tin33 137 vcci 18 osc-vss 58 p15 / db13 98 vcci 138 vss 19 xin 59 p16 / db14 99 vss 139 vcce 20 xout 60 p17 / db15 100 p160 / to21 140 ___ p70 / bclk / wr 21 osc-vcc 61 vref0 101 p161 / to22 141 ____ p71 / wait 22 vss 62 avcc0 102 p162 / to23 142 ____ p72 / hreq 23 vcnt 63 ad0in0 103 p163 / to24 143 ____ p73 / hack 24 vss 64 ad0in1 104 p164 / to25 144 p74 / rtdtxd 25 p30 / a15 65 ad0in2 105 p165 / to26 145 p75 / rtdrxd 26 p31 / a16 66 ad0in3 106 p166 / to27 146 p76 / rtdack 27 p32 / a17 67 ad0in4 107 p167 / to28 147 p77 / rtdclk 28 p33 / a18 68 ad0in5 108 p172 / tin24 148 p93 / to16 29 p34 / a19 69 ad0in6 109 p173 / tin25 149 p94 / to17 30 p35 / a20 70 ad0in7 110 p174 / txd2 150 p95 / to18 31 p36 / a21 71 ad0in8 111 p175 / rxd2 151 p96 / to19 32 p37 / a22 72 ad0in9 112 p176 / txd3 152 p97 / to20 33 p20 / a23 73 ad0in10 113 p177 / rxd3 153 _____ reset 34 p21 / a24 74 ad0in11 114 vcce 154 mod0 35 p22 / a25 75 ad0in12 115 vss 155 mod1 36 p23 / a26 76 ad0in13 116 p82 / txd0 156 fp 37 vcce 77 ad0in14 117 p83 / rxd0 157 vcce 38 vss 78 ad0in15 118 p84 / sclki0 / sclko0 158 vss 39 p24 / a27 79 avss0 119 p85 / txd1 159 p110 / to0 40 p25 / a28 80 vcce 120 p86 / rxd1 160 p111 / to1
1 1-20 ver.0.10 overview 1.4 pin layout table 1.4.1 pin assignments of the 240qfp (2/2) no. pin name no. pin name no. pin name no. pin name 161 p112 / to2 181 jtms 201 p134 / tin20 221 p156 / tin6 162 p113 / to3 182 jtck 202 p135 / tin21 222 p157 / tin7 163 p114 / to4 183 jtrst 203 p136 / tin22 223 ___ ___ p41 / blw / ble 164 p115 / to5 184 jtdo 204 p137 / tin23 224 ___ ___ p42 / bhw / bhe 165 p116 / to6 185 jtdi 205 vcce 225 vcci 166 p117 / to7 186 p103 / to11 206 vss 226 vss 167 p100 / to8 187 p104 / to12 207 p140 / tin8 227 vref1 168 p101 / to9 188 p105 / to13 208 p141 / tin9 228 avcc1 169 p102 / to10 189 p106 / to14 209 p142 / tin10 229 ad1in0 170 vdd 190 p107 / to15 210 p143 / tin11 230 ad1in1 171 vcci 191 p124 / tclk0 211 p144 / tin12 231 ad1in2 172 vss 192 p125 / tclk1 212 p145 / tin13 232 ad1in3 173 p210 / to37 193 p126 / tclk2 213 p146 / tin14 233 ad1in4 174 p211 / to38 194 p127 / tclk3 214 p147 / tin15 234 ad1in5 175 p212 / to39 195 vcci 215 p150 / tin0 235 ad1in6 176 p213 / to40 196 vss 216 p151 / tin1 236 ad1in7 177 p214 / to41 197 p130 / tin16 217 p152 / tin2 237 ad1in8 178 p215 / to42 198 p131 / tin17 218 p153 / tin3 238 ad1in9 179 p216 / to43 199 p132 / tin18 219 p154 / tin4 239 ad1in10 180 p217 / to44 200 p133 / tin19 220 p155 / tin5 240 ad1in11
1 1-21 ver.0.10 package: 255f7f (0.8 mm pitch) note 1: nc pins (w19, y1) are not internally connected. leave them open. note 2: use caution when using p224/a11 and p225/a12 because they have a debug event function. note 3: 255fbga is currently under development. figure 1.4.2 pin layout diagram of the 255fbga (top view) ab c de f gh jk l mnp rt uv wy 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ad1in12 ad1in13 ad1in14 ad1in15 avss1 p43 /rd p44 /cs0 p45 /cs1 p46 /a13 p47 /a14 p220 /ctx p221 /crx p222 p223 p224 /a11 p225 /a12 vss osc- vss xin xout osc- vcc vss vcnt vss p30 /a15 p31 /a16 p32 /a17 p33 /a18 p34 /a19 p35 /a20 trclk trsync p36 /a21 p37 /a22 p20 /a23 p21 /a24 p23 /a26 p22 /a25 vcce vss p24 /a27 p25 /a28 p26 /a29 p27 /a30 p00 /db0 p01 /db1 p02 /db2 p03 /db3 p04 /db4 p05 /db5 p06 /db6 p07 /db7 vcce vss p10 /db8 p11 /db9 p12 /db10 p13 /db11 p14 /db12 p15 /db13 p16 /db14 p17 /db15 vref0 avcc0 ad0in0 ad0in1 ad0in2 ad0in3 ad0in4 ad0in5 ad0in6 ad0in7 ad0in8 ad0in9 ad0in10 ad0in11 ad0in12 ad0in13 ad0in14 ad0in15 avss0 vcce vss p180 /to29 p181 /to30 p182 /to31 p183 /to32 p184 /to33 p185 /to34 p186 /to35 p187 /to36 p190 /tin26 p191 /tin27 p192 /tin28 p193 /tin29 p194 /tin30 p196 /tin32 p195 /tin31 p197 /tin33 vcci vss p160 /to21 p161 /to22 p162 /to23 p163 /to24 p164 /to25 p165 /to26 p166 /to27 p167 /to28 p172 /tin24 p173 /tin25 p174 /txd2 p175 /rxd2 p176 /txd3 p177 /rxd3 vcce vss p82 /txd0 p87 /sclk1 p84 /sclk0 p85 /txd1 p86 /rxd1 trdata 0 trdata 1 trdata 2 trdata 3 p200 /txd4 p201 /rxd4 p202 /txd5 p203 /rxd5 vcci vss p83 /rxd0 vss p61 p62 fvcc p64 /sbi p65 /sclk4 p66 /sclk5 p63 vcci vss vcce p67 /adtrg p71 /wait p72 /hreq p73 /hack p74/ rtdtxd p75/ rtdrxd p76/ rtdack p77/ rtdclk p93 /to16 p94 /to17 p95 /to18 p96 /to19 p97 /to20 reset mod0 mod1 fp vcce vss p110 /to0 p111 /to1 p112 /to2 p113 /to3 trdata 4 trdata 5 trdata 6 trdata 7 p114 /to4 p115 /to5 p116 /to6 p117 /to7 p100 /to8 p101 /to9 p102 /to10 vdd vcci vss p210 /to37 p211 /to38 p212 /to39 p214 /to41 p215 /to42 p213 /to40 p216 /to43 p217 /to44 jdbi jtck jevent 0 jtrst jevent 1 jtdo jtdi p103 /to11 p104 /to12 p105 /to13 p106 /to14 p107 /to15 p124 /tclk0 p125 /tclk1 p126 /tclk2 p127 /tclk3 vcci vss p130 /tin16 p131 /tin17 p132 /tin18 p133 /tin19 p134 /tin20 p135 /tin21 p136 /tin22 p137 /tin23 vcce vss p140 /tin8 p141 /tin9 p142 /tin10 p143 /tin11 p144 /tin12 p145 /tin13 p146 /tin14 p147 /tin15 p150 /tin0 p151 /tin1 p152 /tin2 p153 /tin3 p154 /tin4 p155 /tin5 p156 /tin6 p157 /tin7 p41 /blw p42 /bhw vcci vss vref1 avcc1 ad1in0 ad1in1 ad1in2 ad1in3 ad1in4 ad1in5 ad1in6 ad1in7 ad1in8 ad1in10 ad1in9 ad1in11 m32170f3vwg M32170F4VWG m32170f6vwg p70 /bclk jtms n.c n.c overview 1.4 pin layout
1 1-22 ver.0.10 table 1.4.2 pin assignments of the 255fbga (1/2) no. pin name no. pin name no. pin name no. pin name a1 c1 ad1in14 e1 p220 / ctx h1 vcnt a2 ad1in9 c2 ad1in13 e2 ______ p47 / a14 h2 vss a3 ad1in8 c3 ad1in4 e3 _____ p46 / a13 h3 osc-voc a4 ad1in6 c4 ad1in5 e4 _____ p45 / cs1 h4 xout a5 ad1in2 c5 ad1in1 e17 p101 / to9 h17 p111 / to1 a6 verf1 c6 vss e18 vcci h18 trdata4 a7 _______ p41 / blw c7 p157 / tin7 e19 vdd h19 p113 / to3 a8 p154 / tin4 c8 p153 / tin3 e20 p102 / to10 h20 p112 / to2 a9 p150 / tin0 c9 p147 / tin15 f1 p224 / a11 j1 p32 / a17 a10 p144 / tin12 c10 p143 / tin11 f2 p223 j2 p31 / a16 a11 p140 / tin8 c11 p141 / tin9 f3 p222 j3 p30 / a15 a12 p136 / tin22 c12 p137 / tin23 f4 p221 / crx j4 vss a13 p132 / tin18 c13 p133 / tin19 f17 p115 / to5 j17 fp a14 vcci c14 vss f18 p100 / to8 j18 p110 / to0 a15 p124 / tclk0 c15 p125 / tclk1 f19 p117 / to7 j19 vss a16 p104 / to12 c16 p105 / to13 f20 p116 / to6 j20 vcce a17 jevent1 c17 jtdo g1 xin k1 trclk a18 jevent0 c18 p213 / to40 g2 osc-vss k2 p35 / a20 a19 jtck c19 p215 / to42 g3 vss k3 p34 / a19 a20 jtms c20 p214 / to41 g4 p225 / a12 k4 p33 / a18 b1 ad1in12 d1 _________ p44 / cs0 g17 tradata5 k17 p97 / to20 b2 ad1in11 d2 _____ p43 / rd g18 p114 / to4 k18 mod1 b3 ad1in10 d3 avss1 g19 tradata7 k19 mod0 b4 ad1in7 d4 ad1in15 g20 tradata6 k20 ____________ reset b5 ad1in3 d5 ad1in0 b6 avcc1 d6 vcci b7 ________ p42 / bhw d7 p156 / tin6 b8 p155 / tin5 d8 p152 / tin2 b9 p151 / tin1 d9 p146 / tin14 b10 p145 / tin13 d10 p142 / tin10 b11 vss d11 vcce b12 p135 / tin21 d12 p134 / tin20 b13 p131 / tin17 d13 p130 / tin16 b14 p127 / tclk3 d14 p126 / tclk2 b15 p102 / to15 d15 p106 / to4 b16 p103 / to11 d16 jtdi b17 jtrst d17 vss b18 jdbi d18 p212 / to39 b19 p217 / to44 d19 p211 / to38 b20 p216 / to43 d20 p210 / to37 overview 1.4 pin layout
1 1-23 ver.0.10 table 1.4.2 pin assignments of the 255fbga (2/2) no. pin name no. pin name no. pin name no. pin name l1 p36 / a21 p1 p00 / db0 u1 p12 / db10 w1 p16 / db14 l2 p37 / a22 p2 p01 / db1 u2 p13 / db11 w2 vref0 l3 p20 / a23 p3 p02 / db2 u3 p14 / db12 w3 ad0in0 l4 trsync p4 p27 / a30 u4 p11 / db9 w4 ad0in3 l17 p93 / to16 p17 ______ p67 / adtrg u5 ad0in6 w5 ad0in7 l18 p94 / to17 p18 vcci u6 ad0in10 w6 ad0in11 l19 p95 / to18 p19 vss u7 ad0in14 w7 ad0in15 l20 p96 / to19 p20 vcce u8 vss w8 p180 / to29 m1 p22 / a25 r1 p04 / db4 u9 p183 / to32 w9 p184 / to33 m2 p23 / a26 r2 p05 / db5 u10 p187 / to36 w10 p190 / tin26 m3 vcce r3 p06 / db6 u11 p193 / tin29 w11 p196 / tin32 m4 p21 / a24 r4 p03 / db3 u12 p197 / tin33 w12 p160 / to21 m17 p74 / rtdtxd r17 p63 u13 p161 / to22 w13 p164 / to25 m18 p75 / rtdrxd r18 ___ p64 / sbi u14 p165 / to26 w14 p172 / tin24 m19 p76 / rtdack r19 p65 / sclk4 u15 p173 / tin25 w15 p176 / txd3 m20 p77 / rtdclk r20 p66 / sclk5 u16 p177 / rxd3 w16 p82 / txd0 n1 p24 / a27 t1 vcce u17 p83 / rxd0 w17 p86 / rxd1 n2 p25 / a28 t2 vss u18 p203 / rxd5 w18 trdata2 n3 p26 / a29 t3 p10 / db8 u19 vcci w19 n.c n4 vss t4 p07 / db7 u20 vss w20 p201 / rxd4 n17 p70 / bclk t17 fvcc v1 p15 / db13 y1 n.c n18 _____ p71 / wait t18 vss v2 p17 / db15 y2 avcc0 n19 _____ p72 / hreq t19 p61 v3 ad0in1 y3 ad0in2 n20 _____ p73 / hack t20 p62 v4 ad0in5 y4 ad0in4 v5 ad0in9 y5 ad0in8 v6 ad0in13 y6 ad0in12 v7 vcce y7 avss0 v8 p182 / to31 y8 p181 / to30 v9 p186 / to35 y9 p185 / to34 v10 p192 / tin28 y10 p191 / tin27 v11 p194 / tin30 y11 p195 / tin31 v12 vcci y12 vss v13 p162 / to23 y13 p163 / to24 v14 p166 / to27 y14 p167 / to28 v15 p174 / txd2 y15 p175 / rxd2 v16 vcce y16 vss v17 p84 / sclk0 y17 p85 / txd1 v18 p87 / sclk1 y18 trdata0 v19 p200 / txd4 y19 trdata1 v20 p202 / txd5 y20 trdata3 overview 1.4 pin layout
1 1-24 ver.0.10 overview 1.4 pin layout j this is a blank page. j
chapter 2 chapter 2 cpu 2.1 cpu registers 2.2 general-purpose registers 2.3 control registers 2.4 accumulator 2.5 program counter 2.6 data formats
2 2-2 ver.0.10 cpu 2.1 cpu registers 2.1 cpu registers the m32r has sixteen general-purpose registers, five control registers, an accumulator, and a program counter. the accumulator is a 56-bit configuration, and all other registers are a 32-bit configuration. 2.2 general-purpose registers general-purpose registers are 32 bits in width and there are sixteen of them (r0 to r15), which are used to hold data and base addresses. especially, r14 is used as a link register, and r15 is used as a stack pointer. the link register is used to store the return address when executing a subroutine call instruction. the stack pointer is switched between an interrupt stack pointer (spi) and a user stack pointer (spu) depending on the value of the processor status word register (psw)'s stack mode (sm) bit. 31 31 00 r8 r9 r10 r11 r12 r13 r14 (link register) r15 (stack pointer) (note) note: the stack pointer is switched between an interrupt stack pointer (spi) and a user stack pointer (spu) depending on the value of the psw's sm bit. r0 r1 r2 r3 r4 r5 r6 r7 figure 2.2.1 general-purpose registers
2 2-3 ver.0.10 cpu 2.3 control registers 2.3 control registers there are five control registers-processor status word register (psw), condition bit register (cbr), interrupt stack pointer (spi), user stack pointer (spu), and backup pc (bpc). dedicated "mvtc" and "mvfc" instructions are used to set and read these control registers. figure 2.3.1 control registers control registers cr0 cr1 cr2 cr3 0 31 psw cbr spi spu processor status word register condition bit register interrupt stack pointer user stack pointer bpc cr6 backup pc crn notes 1: crn (n = 0-3, 6) denotes control register numbers. 2: dedicated "mvtc" and "mvfc" instructions are used to set and read the control registers.
2 2-4 ver.0.10 cpu 2.3 control registers 2.3.1 processor status word register: psw (cr0) the processor status word register (psw) is used to indicate the status of the m32r. it consists of a regularly used psw field and a special bpsw field which is used to save the psw field when an eit occurs. the psw field consists of several bits labeled stack mode (sm), interrupt enable (ie), and condition bit (c). the bpsw field consists of backup bits of the foregoing, i.e., backup sm bit (bsm), backup ie bit (bie), and backup c bit (bc). d bit name function initial r w 16 bsm (backup sm) holds the value of sm bit when eit indeterminate is accepted. 17 bie (backup ie) holds the value of ie bit when eit indeterminate is accepted. 23 bc (backup c) holds the value of c bit when eit indeterminate is accepted. 24 sm (stack mode) 0: interrupt stack pointer is used. 0 1: user stack pointer is used. 25 ie (interrupt enable) 0: no interrupt is accepted. 0 1: interrupt is accepted. 31 c (condition bit) depending on instruction execution, it indicates 0 whether operation resulted in a carry, borrow, or overflow. notes 1: "initial" shows the state immediately after reset, r = o means the register is readable, w = o means the register is writable. 2: for changes of the state of each bit when an eit event occurs, refer to chapter 4, "eit. (note 1) 16 17 23 24 25 31(lsb) 15 8 7 0(msb) sm ie c bc bsm bie 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 psw bpsw field psw field
2 2-5 ver.0.10 cpu 2.3 control registers 2.3.2 condition bit register: cbr (cr1) the condition bit register (cbr) is created as a separate register from the psw by extracting the condition bit (c) from it. the value written to the psw c bit is reflected in this register. this register is a read-only register (writes to this register by "mvtc" instruction are ignored). 2.3.3 interrupt stack pointer: spi (cr2) user stack pointer: spu (cr3) the interrupt stack pointer (spi) and user stack pointer (spu) hold the current address of the stack pointer. these registers can be accessed as general-purpose register r15. in this case, whether r15 is used as spi or as spu depends on the psw's stack mode (sm) bit. 2.3.4 backup pc: bpc (cr6) the backup pc (bpc) is a register used to save the value of the program counter (pc) when an eit occurs. bit 31 is fixed to 0. when an eit occurs, the value held in the pc immediately before the eit occurred or the value of the next instruction is set in this register. when the "rte" instruction is executed, the saved value is returned from the bpc to the pc. however, the two low-order bits of the pc when thus returned are always fixed to "00" (control always returns to word boundaries.) spi spi spu spu 0(msb) 0(msb) 31(lsb) 31(lsb) cbr 0(msb) 31(lsb) 0000000000000000000000000000000 c bpc bpc 0 31(lsb) 0(msb)
2 2-6 ver.0.10 2.4 accumulator the accumulator (acc) is a 56-bit register used by dsp function instructions. when read out or written to, it is handled as a 64-bit register. when reading, the value of bit 8 is sign-extended. when writing, bits 0--7 are ignored. also, the accumulator is used by the multiplication instruction "mul." note that when executing this instruction, the value of the accumulator is destroyed. the "mvtachi" and "mvtaclo" instructions are used to write to the accumulator. the "mvtachi" instruction writes data to the 32 high-order bits (bits 0-31), and the "mvtaclo" instruction writes data to the 32 low-order bits (bits 32-63). the "mvfachi," "mvfaclo," and "mvfacmi" instructions are used to read data from the accumulator. the "mvfachi" instruction reads data from the 32 high-order bits (bits 0-31), the "mvfaclo" instruction reads data from the 32 low-order bits (bits 32-63), and the "mvfachi" instruction reads data from the 32 middle bits (bits 16-47). cpu 2.4 accumulator note: bits 0-7 always show the sign-extended value of bit 8. writes to this bit field are ignored. pc pc 0 31(lsb) 0(msb) 2.5 program counter the program counter (pc) is a 32-bit counter used to hold the address of the currently executed instruction. because m32r instructions each start from an even address, the lsb (bit 31) is always 0. 32 48 63(lsb) 31 16 15 0(msb) 47 78 range of bits read by mvfacmi instruction range of bits read/written to by mvfachi/mvtachi instructions range of bits read/written to by mvfaclo/mvtaclo instructions acc (note)
2 2-7 ver.0.10 2.6 data formats 2.6.1 data types there are several data types that can be handled by the m32r's instruction set. these include signed and unsigned 8, 16, and 32-bit integers. values of signed integers are represented by 2's complements. figure 2.6.1 data types cpu 2.6 data formats signed byte (8-bit) integer unsigned byte (8-bit) integer signed halfword (16-bit) integer unsigned halfword (16-bit) integer signed word (32-bit) integer unsigned word (32-bit) integer 0(msb) 0(msb) 0(msb) 0(msb) 0(msb) 0(msb) 7(lsb) 7(lsb) 15(lsb) 15(lsb) 31(lsb) 31(lsb) s s s s : sign bit
2 2-8 ver.0.10 cpu 2.6 data formats 2.6.2 data formats (1) data formats in register data sizes in m32r registers are always words (32 bits). when loading byte (8-bit) or halfword (16-bit) data from memory into a register, the data is sign- extended (ldb, ldh instructions) or zero-extended (ldub, lduh instructions) into word (32-bit) data before being stored in the register. when storing data from m32r register into memory, the register data is stored in memory in different sizes depending on the instructions used. the st instruction stores the entire 32-bit data of the register, the sth instruction stores the least significant 16-bit data, and the stb instruction stores the least significant 8-bit data. figure 2.6.2 data formats in register rn 0(msb) 31(lsb) byte rn 0(msb) 31(lsb) halfword rn 0(msb) 31(lsb) word sign-extended (ldb instruction) or zero-extended (ldub instruction) from memory (ldb, ldub instructions) rn 0(msb) 31(lsb) byte rn 0(msb) 31(lsb) halfword rn 0(msb) 31(lsb) word to memory (stb instruction) to memory (sth instruction) to memory (st instruction) from memory (ldh, lduh instructions) from memory (ld instructions) sign-extended (ldh instruction) or zero-extended (lduh instruction) 24 16 24 16
2 2-9 ver.0.10 (2) data formats in memory data sizes in memory are either byte (8 bits), halfword (16 bits), or word (32 bits). byte data can be located at any address. however, halfword data must be located at halfword boundaries (where the lsb address bit = "0"), and word data must be located at word boundaries (where two lsb address bits = "00"). if an attempt is made to access memory data across these halfword or word boundaries, an address exception is generated. figure 2.6.3 data formats in memory cpu 2.6 data formats address byte halfword word + 0 address + 1 address + 2 address + 3 address 031 byte 7 8 15 16 23 24 (msb) (lsb) (msb) (lsb) byte byte byte halfword halfword word
2 2-10 ver.0.10 cpu 2.6 data formats (3) endian the following shows the generally used endian methods and the m32r family endian. figure 2.6.4 endian methods figure 2.6.5 m32r family endian bit endian byte endian big endian little endian note: even for bit big endian, h'01 is not b'10000000. (h'01) (h'01234567) msb lsb hh hl lh ll h'01 h'23 h'45 h'67 msb lsb ll lh hl hh h'67 h'45 h'23 h'01 msb lsb b'0000001 d0 d7 msb lsb b'0000001 d7 d0 little/little ll lh hl hh big/big hh hl lh ll little/big hh hl lh ll endian (bit/byte) data arrangement mpu name 7700 family m16c family competition m32r family m16 family 7-0 31-24 15-8 23-16 0-7 24-31 8-15 16-23 bit number +0 +1 +2 +3 +0 +1 +2 +3 +0 +1 +2 +3 address msb lsb msb lsb msb lsb ex:0x01234567 .byte 67,45,23,01 .byte 01,23,45,67 .byte 01,23,45,67 note: the m32r's endian method is big endian for both bit and byte. 7-0 31-24 15-8 23-16
2 2-11 ver.0.10 (4) transfer instructions figure 2.6.6 transfer instructions cpu 2.6 data formats ?constant transfer ld24 rdest, #imm24 ldi rdest, #imm16 ldi rdest, #imm8 seth rdest, #imm16 23 0 rdest imm24 31 0 ld24 rdest, #imm24 15 0 rdest imm16 31 0 seth rdest, #imm16 00 8 15 00 00 ?register to register transfer mv rdest, rsrc ?control register transfer mvfc rdest, crsrc mvtc rsrc, crdest note: for the mvtc instruction, the condition bit c does not change unless crdest is cr0 (psw). rsrc 31 0 rdest 31 0 rsrc 31 0 crdest 31 0 mvtc rsrc, crdest mv rdest, rsrc
2 2-12 ver.0.10 (5) memory (signed) to register transfer figure 2.6.7 memory (signed) to register transfer (6) memory (unsigned) to register transfer figure 2.6.8 memory (unsigned) to register transfer ?signed 32 bits ld24 rsrc, #label ld rdest, @rsrc ?signed 16 bits ld24 rsrc, #label ldh rdest, @rsrc ?signed 8 bits ld24 rsrc, #label ldb rdest, @rsrc label rdest 31 0 +0 +1 +2 +3 rdest label 00 00 ff ff check the msb 0 = positive 1 = negative 31 0 +0 +1 +2 +3 rdest label 00 00 00 ff ff ff 31 0 +0 +1 +2 +3 memory register check the msb 0 = positive 1 = negative ?unsigned 32 bits ld24 rsrc, #label ld rdest, @rsrc ?unsigned 16 bits ld24 rsrc, #label ldub rdest, @rsrc ?unsigned 8 bits ld24 rsrc, #label lduh rdest, @rsrc rdest 00 00 31 0 label +0 +1 +2 +3 label +0 +1 +2 +3 rdest 31 0 label +0 +1 +2 +3 rdest 00 00 00 31 0 memory register cpu 2.6 data formats
2 2-13 ver.0.10 (7) things to be noted for data transfer note that in data transfer, data arrangements in registers and those in memory are different. figure 2.6.9 difference in data arrangements data in memory data in register word data (32 bits) +0 +1 +2 +3 d0 d31 hh hl lh ll d0 d31 hh hl lh ll half-word data (16 bits) +0 +1 +2 +3 d0 d31 h l d0 d15 h l byte data (8 bits) +0 +1 +2 +3 d0 d31 d0 d7 msb lsb msb lsb msb lsb msb lsb msb lsb msb lsb (r0-r15) (r0-r15) (r0-r15) cpu 2.6 data formats
2 2-14 ver.0.10 j this is a blank page. j
chapter 3 chapter 3 address space 3.1 outline of address space 3.2 operation modes 3.3 internal rom area and extended external area 3.4 internal ram area and sfr area 3.5 eit vector entry 3.6 icu vector table 3.7 note about address space
3 3-2 ver.0.10 3.1 outline of address space the m32r's logical addresses are always handled in 32 bits, providing 4 gbytes of linear ad- dress space. the m32r/e's address space consists of the following: (1) user space ? internal rom area ? extended external area ? internal ram area ? special function register (sfr) area (2) boot program space (3) system space (areas not open to the user) (1) user space a 2 gbytes of address space from h'0000 0000 to h'7fff ffff is the user space. located in this space are the internal rom area, extended external area, internal ram area, and spe- cial function register (sfr) area, an area containing a group of internal peripheral i/o regis- ters. of these, the internal rom and extended external areas are located differently depend- ing on mode settings which will be described later. (2) boot program space a 1 gbyte of address space from h'8000 0000 to h'bfff ffff is the boot program space. this space stores a program (boot program) which enables on-board programming when the internal flash area is blank. (3) system space a 1 gbyte of address space from h'c000 0000 to h'ffff ffff is the system space. this space is reserved for use by development tools such as an in-circuit emulator or a debug monitor, and cannot be used by the user. address space 3.1 outline of address space
3 3-3 ver.0.10 address space 3.1 outline of address space figure 3.1.1 address space of the m32170f6 notes1: this location varies with chip mode settings. 2: the boot program space can read out only when fp = 1, mod0 = 1, and mod1 = 0. boot rom area (8 kbytes) h'0000 0000 h'ffff ffff h'7fff ffff h'8000 0000 user space eit vector entry logical address h'bfff ffff h'c000 0000 boot program space system space (16 mbytes) h'0000 0000 h'00ff ffff h'007f ffff h'0080 0000 sfr area (16 kbytes) h'0080 3fff h'0080 4000 h'001f ffff h'0020 0000 h'003f ffff h'0040 0000 internal rom area (768 kbytes) (note 1) extended external area (4 mbytes) ghost area in units of 128 kbytes 1 gbyte 1 gbyte 2 gbytes ghost area in units of 16 mbytes ghost area in 4 mbytes internal ram area (40 kbytes) h'0080 dfff h'8000 0000 h'8000 1fff ghost area in units of 16 mbytes reserved area (8 kbytes) aaaa a aa a a aa a aaaa reserved area (72 kbytes) h'0081 ffff h'0082 0000 h'0080 e000 h'8000 3fff h'8000 2000 h'8000 4000 h'bfff ffff h'000b ffff h'0010 0000 cs1 area cs0 area reserved area (256 kbytes) h'000f ffff
3 3-4 ver.0.10 address space 3.1 outline of address space figure 3.1.2 address space of the m32170f4 boot rom area (8 kbytes) h'0000 0000 h'ffff ffff h'7fff ffff h'8000 0000 user space eit vector entry logical address h'bfff ffff h'c000 0000 boot program space system space (16 mbytes) h'0000 0000 h'00ff ffff h'007f ffff h'0080 0000 sfr area (16 kbytes) h'0080 3fff h'0080 4000 h'001f ffff h'0020 0000 h'003f ffff h'0040 0000 internal rom area (512 kbytes) (note 1) extended external area (4 mbytes) ghost area in units of 128 kbytes 1 gbyte 1 gbyte 2 gbytes ghost area in units of 16 mbytes ghost area in 4 mbytes internal ram area (32 kbytes) h'0080 bfff h'8000 0000 h'8000 1fff ghost area in units of 16 mbytes reserved area (8 kbytes) aaaa a aa a a aa a aaaa reserved area (80 kbytes) h'0081 ffff h'0082 0000 h'0080 c000 h'8000 3fff h'8000 2000 h'8000 4000 h'bfff ffff h'0007 ffff h'0010 0000 cs1 area cs0 area reserved area (512 kbytes) h'000f ffff notes1: this location varies with chip mode settings. 2: the boot program space can read out only when fp = 1, mod0 = 1, and mod1 = 0.
3 3-5 ver.0.10 address space 3.1 outline of address space figure 3.1.3 address space of the m32170f3 boot rom area (8 kbytes) h'0000 0000 h'ffff ffff h'7fff ffff h'8000 0000 user space eit vector entry logical address h'bfff ffff h'c000 0000 boot program space system space (16 mbytes) h'0000 0000 h'00ff ffff h'007f ffff h'0080 0000 sfr area (16 kbytes) h'0080 3fff h'0080 4000 h'001f ffff h'0020 0000 h'003f ffff h'0040 0000 internal rom area (384 kbytes) (note 1) extended external area (4 mbytes) ghost area in units of 128 kbytes 1 gbyte 1 gbyte 2 gbytes ghost area in units of 16 mbytes ghost area in 4 mbytes internal ram area (32 kbytes) h'0080 bfff h'8000 0000 h'8000 1fff ghost area in units of 16 mbytes reserved area (8 kbytes) aaaa a aa a a aa a aaaa reserved area (80 kbytes) h'0081 ffff h'0082 0000 h'0080 c000 h'8000 3fff h'8000 2000 h'8000 4000 h'bfff ffff h'0005 ffff h'0010 0000 cs1 area cs0 area reserved area (640 kbytes) h'000f ffff notes1: this location varies with chip mode settings. 2: the boot program space can read out only when fp = 1, mod0 = 1, and mod1 = 0.
3 3-6 ver.0.10 3.2 operation modes the 32170 is placed in one of the following modes by setting its operation mode (using mod0 and mod1 pins). for details about the mode used to rewrite the internal flash memory, refer to section 6.5, "programming of internal flash memory." table 3.2.1 setting operation modes mod0 mod1 (note 1) operation mode (note 2) vss vss single-chip mode vss vcc extended external mode vcc vss processor mode (fp = vss) vcc vcc reserved (cannot be used) notes 1: vcc connects to +5 v, and vss connects to gnd. 2: for flash rewrite mode (fp = vcc) not listed in the above table, refer to section 6.5, "programming of internal flash memory." the internal rom and extended external areas are located differently depending on the 32170's operation mode. (all other areas in address space are located the same way.) the address maps of internal rom and extended external areas in each mode are shown below. (for flash rewrite mode (fp = vcc) not listed in the above table, refer to section 6.5, "programming of internal flash memory.") address space 3.2 operation modes figure 3.2.1 m32170f6 operation mode and internal rom/extended external areas h'0000 0000 h'000b ffff h'000c 0000 h'003f ffff non-cs0 area cs1 area (2 mbytes) cs0 area (2 mbytes) cs1 area (2 mbytes) internal rom area (768 kbytes) extended external area extended external area internal rom area (768 kbytes) h'000f ffff h'0010 0000 h'001f ffff h'0020 0000 cs0 area (1 mbyte) reserved area (256 kbytes)
3 3-7 ver.0.10 figure 3.2.2 m32170f4 operation mode and internal rom/extended external areas figure 3.2.3 m32170f3 operation mode and internal rom/extended external areas h'0000 0000 h'0007 ffff h'0008 0000 h'003f ffff non-cs0 area cs1 area (2 mbytes) cs0 area (2 mbytes) cs1 area (2 mbytes) internal rom area (512 kbytes) extended external area extended external area internal rom area (512 kbytes) h'000f ffff h'0010 0000 h'001f ffff h'0020 0000 cs0 area (1 mbyte) reserved area (512 kbytes) h'0000 0000 h'0005 ffff h'0006 0000 h'003f ffff non-cs0 area cs1 area (2 mbytes) cs0 area (2 mbytes) cs1 area (2 mbytes) internal rom area (384 kbytes) extended external area extended external area internal rom area (384 kbytes) h'000f ffff h'0010 0000 h'001f ffff h'0020 0000 cs0 area (1 mbyte) reserved area (640 kbytes) address space 3.2 operation modes
3 3-8 ver.0.10 3.3 internal rom area and extended external area the 8 mbyte area at addresses h'0000 0000 to h'007f ffff in the user space accommodates the internal rom and extended external areas. of this, a 4 mbytes of address space from h'0000 0000 to h'0003 ffff is the area that the user can actually use. all other areas here comprise a 4 mbytes of ghost area. (when programming, do not use this ghost area intentionally.) for details on how the internal rom and extended external areas are located differently depending on the 32170's operation modes set, refer to section 3.2, "operation modes." 3.3.1 internal rom area the internal rom is located in the area shown below. also, this area has an eit vector entry (and icu vector table) located in it at the beginning. table 3.3.1 addresses at which the 32170's internal rom is located type name size located address mf32170f6 768 kbytes h'0000 0000 - h'000b ffff mf32170f4 512 kbytes h'0000 0000 - h'0007 ffff mf32170f3 384 kbytes h'0000 0000 - h'0005 ffff 3.3.2 extended external area an extended external area is provided only when extended external mode or processor mode has been selected when setting the 32170's operation mode. for access to this extended external area, the 32170 outputs the control signals necessary to access external devices. ________ _______ the 32170's cs0 and cs1 signals are output corresponding to the address mapping of the ex- ________ _______ tended external area. the cs0 signal is output for the cs0 area, and the cs1 signal is output for the cs1 area. table 3.3.2 address mapping of the extended external area in each operation mode of the 32170 operation mode address mapping of the extended external area single-chip mode none extended external mode addresses h'0010 0000 to h'001f ffff (cs0 area: 1 mbytes) addresses h'0020 0000 to h'003f ffff (cs1 area: 2 mbytes) processor mode addresses h'0000 0000 to h'001f ffff (cs0 area: 2 mbytes) addresses h'0020 0000 to h'003f ffff (cs1 area: 2 mbytes) address space 3.3 internal rom/extended external area
3 3-9 ver.0.10 3.4 internal ram area and sfr area the 8 mbyte area at addresses h'0080 0000 to h'00ff ffff in the user space accommodates the internal ram area and special function register (sfr) area. of this, a 128 kbytes of address space from h'0080 0000 to h'0081 ffff is the area that the user can actually use. all other areas here comprise a ghost area in units of 128 kbytes. (when programming, do not use this ghost area intentionally.) 3.4.1 internal ram area the internal ram is located in the area shown below. table 3.4.1 addresses at which the 32170's internal rom is located type name size located address mf32170f6 40 kbytes h'0080 4000 - h'0080 dfff mf32170f4 32 kbytes h'0080 4000 - h'0080 bfff mf32170f3 3.4.2 special function register (sfr) area addresses h'0080 0000 to h'0080 3ffff are the special function register (sfr) area. this area has registers for internal peripheral i/o located in it. address space 3.4 internal rom/sfr area figure 3.4.1 internal ram area and special function register (sfr) area of the m32170f6 h'0080 0000 h'0080 dfff sfr area (16 kbytes) internal ram (40 kbytes) h'0080 3fff h'0080 4000 pseudo-flash emulation areas separated in units of 8 kbytes or 4 kbytes can be allocated here. for details, refer to section 6.7.
3 3-10 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.2 internal ram area and special function register (sfr) area of the m32170f4 and m32170f3 h'0080 0000 h'0080 bfff sfr area (16 kbytes) internal ram (32 kbytes) h'0080 3fff h'0080 4000 pseudo-flash emulation areas separated in units of 8 kbytes or 4 kbytes can be allocated here. for details, refer to section 6.7.
3 3-11 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.3 outline address mapping of the sfr area h'0080 0000 h'0080 007e h'0080 0180 interrupt controller (icu) h'0080 0080 a-d0 converter h'0080 00ee serial i/o0-3 h'0080 0100 h'0080 0146 wait controller mjt (common part) mjt (top) mjt (tio) mjt (tms) h'0080 0200 h'0080 0240 h'0080 0300 h'0080 03c0 h'0080 03e0 h'0080 03fe note: the real-time debugger (rtd) is designed to be an independent module operated from an external source, and is transparent to the cpu. 0 7 8 15 h'0080 0a00 +0 address +1 address 0 7 8 15 multijunction timer (mjt) flash control h'0080 07e0 h'0080 07f2 h'0080 023e h'0080 02fe mjt (tod0) h'0080 078c h'0080 07de mjt (tid0) h'0080 0790 h'0080 078e multijunction timer (mjt) serial i/o4, 5 h'0080 0a26 h'0080 0a80 a-d1 converter h'0080 0aee mjt (tod1) mjt (tom0) h'0080 0bde h'0080 0c8c h'0080 0cde mjt (tml1) h'0080 0fe0 h'0080 0ffe h'0080 0400 dmac h'0080 0478 can0 h'0080 1000 h'0080 11fe h'0080 0700 input/output port h'0080 0756 h'0080 03be h'0080 03d8 mjt (tml0) h'0080 0b8c mjt (tid1) h'0080 0b8e h'0080 0b90 h'0080 0c8e h'0080 0c90 mjt (tid2) h'0080 0760 h'0080 3ffe +0 address +1 address multijunction timer (mjt)
3 3-12 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.4 register mapping of the sfr area (1) h'0080 0000 h'0080 0002 h'0080 0004 h'0080 0006 h'0080 006c h'0080 006e h'0080 0070 h'0080 0072 h'0080 0074 h'0080 0076 h'0080 0078 h'0080 007a h'0080 007c h'0080 007e h'0080 0080 h'0080 0082 h'0080 0084 h'0080 0086 h'0080 0088 h'0080 008a h'0080 0090 +0 address +1 address interrupt vector register (ivect) d0 d7 d8 d15 interrupt mask register (imask) sbi control register (sbicr) a-d0 conversion interrupt control register (iad0ccr) sio0 transmit interrupt control register (isio0txcr) sio0 receive interrupt control register (isio0rxcr) sio1 receive interrupt control register (isio1rxcr) sio1 transmit interrupt control register (isio1txcr) dma0-4 interrupt control register (idma04cr) mjt output interrupt control register 0 (imjtocr0) mjt output interrupt control register 2 (imjtocr2) mjt output interrupt control register 4 (imjtocr4) mjt output interrupt control register 6 (imjtocr6) mjt input interrupt control register 0 (imjticr0) mjt output interrupt control register 1 (imjtocr1) mjt output interrupt control register 3 (imjtocr3) mjt output interrupt control register 5 (imjtocr5) mjt output interrupt control register 7 (imjtocr7) mjt input interrupt control register 1 (imjticr1) mjt input interrupt control register 2 (imjticr2) mjt input interrupt control register 3 (imjticr3) mjt input interrupt control register 4 (imjticr4) a-d0 single mode register 0 (ad0sim0) a-d0 single mode register 1 (ad0sim1) a-d0 scan mode register 0 (ad0scm0) a-d0 scan mode register 1 (ad0scm1) a-d0 successive approximation register (ad0sar) a-d0 comparate data register (ad0cmp) h'0080 008c h'0080 0092 h'0080 0094 10-bit a-d0 data register 0 (ad0dt0) 10-bit a-d0 data register 1 (ad0dt1) 10-bit a-d0 data register 2 (ad0dt2) 10-bit a-d0 data register 3 (ad0dt3) 10-bit a-d0 data register 4 (ad0dt4) 10-bit a-d0 data register 5 (ad0dt5) 10-bit a-d0 data register 6 (ad0dt6) 10-bit a-d0 data register 7 (ad0dt7) 10-bit a-d0 data register 8 (ad0dt8) 10-bit a-d0 data register 9 (ad0dt9) 10-bit a-d0 data register 10 (ad0dt10) 10-bit a-d0 data register 11 (ad0dt11) 10-bit a-d0 data register 12 (ad0dt12) 10-bit a-d0 data register 13 (ad0dt13) 10-bit a-d0 data register 14 (ad0dt14) 10-bit a-d0 data register 15 (ad0dt15) h'0080 0096 h'0080 0098 h'0080 009a h'0080 009c h'0080 009e h'0080 00a0 h'0080 00a2 h'0080 00a4 h'0080 00a6 h'0080 00a8 h'0080 00aa h'0080 00ac h'0080 00ae h'0080 00d0 address h'0080 0066 h'0080 0068 h'0080 006a rtd interrupt control register (irtdcr) sio2,3 transmit/receive interrupt control register (iso23cr) dma5-9 interrupt control register (idma59cr) tod0 output interrupt control register (itod0cr) tid0 output interrupt control register (itid0cr) 8-bit a-d0 data register 0 (ad08dt0) h'0080 0064 h'0080 0062 h'0080 0060 can0 transmit/receive & error interrupt control register (ican0cr) tid2 output interrupt control register (itid2cr) tml1 input interrupt control register (itml1cr) a-d1 conversion interrupt control register (iad1ccr) sio4,5 transmit/receive interrupt control register (isio45cr) tod1-tom0 output interrupt control register (itom0cr) tid1 output interrupt control register (itid1cr) blank addresses are reserved areas ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-13 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.5 register mapping of the sfr area (2) h'0080 00da h'0080 00dc h'0080 00de h'0080 00e0 h'0080 00e4 h'0080 00e6 h'0080 00e8 h'0080 00ea h'0080 00ec h'0080 00ee h'0080 0100 h'0080 0102 h'0080 0110 h'0080 0112 h'0080 0114 h'0080 0116 h'0080 0120 h'0080 0126 +0 address +1 address d0 d7 d8 d15 h'0080 0122 h'0080 0130 sio1 baud rate register (s1baur) sio0 transmit buffer register (s0txb) sio0 receive buffer register (s0rxb) sio23 interrupt status register (si23stat) 8-bit a-d0 data register 5 (ad08dt5) 8-bit a-d0 data register 6 (ad08dt6) 8-bit a-d0 data register 7 (ad08dt7) 8-bit a-d0 data register 8 (ad08dt8) 8-bit a-d0 data register 9 (ad08dt9) 8-bit a-d0 data register 10 (ad08dt10) 8-bit a-d0 data register 11 (ad08dt11) 8-bit a-d0 data register 12 (ad08dt12) 8-bit a-d0 data register 13 (ad08dt13) 8-bit a-d0 data register 14 (ad08dt14) 8-bit a-d0 data register 15 (ad08dt15) h'0080 0132 h'0080 0134 h'0080 0136 h'0080 0140 h'0080 0142 h'0080 0144 h'0080 0146 h'0080 0180 h'0080 0200 h'0080 0202 h'0080 0210 h'0080 0212 h'0080 0214 address h'0080 00e2 sio03 interrupt mask register (si03mask) sio03 receive interrupt cause select register (si03sel) sio0 transmit control register (s0tcnt) sio0 transmit/receive mode register (s0mod) sio0 receive control register (s0rcnt) h'0080 0124 sio1 baud rate register (s1baur) sio1 transmit buffer register (s1txb) sio1 receive buffer register (s1rxb) sio1 transmit control register (s1tcnt) sio0 transmit/receive mode register (s1mod) sio1 receive control register (s1rcnt) sio2 baud rate register (s2baur) sio2 transmit buffer register (s2txb) sio2 receive buffer register (s2rxb) sio2 transmit control register (s2tcnt) sio2 transmit/receive mode register (s2mod) sio2 receive control register (s2rcnt) sio3 baud rate register (s3baur) sio3 transmit buffer register (s3txb) sio3 receive buffer register (s3rxb) sio3 transmit control register (s3tcnt) sio3 transmit/receive mode register (s3mod) sio3 receive control register (s3rcnt) wait cycles control register (wtccr) h'0080 0204 clock bus & input event bus control register (ckiebcr) prescaler register 0 (prs0) output event bus control register (oebcr) prescaler register 1 (prs1) prescaler register 2 (prs2) tclk input processing control register (tclkcr) tin input processing control register 0 (tincr0) tin input processing control register 1 (tincr1) h'0080 00d2 h'0080 00d4 h'0080 00d6 h'0080 00d8 8-bit a-d0 data register 1 (ad08dt1) 8-bit a-d0 data register 2 (ad08dt2) 8-bit a-d0 data register 3 (ad08dt3) 8-bit a-d0 data register 4 (ad08dt4) blank addresses are reserved areas. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-14 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.6 register mapping of the sfr area (3) +0 address +1 address d0 d7 d8 d15 h'0080 021e f/f source select register 0 (ffs0) f/f source select register 1 (ffs1) f/f protect register 0 (ffp0) f/f data register 0 (ffd0) h'0080 0220 h'0080 0222 h'0080 0224 h'0080 0226 h'0080 0228 h'0080 022a f/f protect register 1 (ffp1) f/f data register 1 (ffd1) h'0080 0230 h'0080 0232 h'0080 0234 h'0080 0236 h'0080 0238 h'0080 023a h'0080 023c h'0080 023e h'0080 0240 h'0080 0242 h'0080 0244 h'0080 0246 h'0080 0250 top interrupt control register 0 (topir0) top interrupt control register 1 (topir1) top interrupt control register 2 (topir2) tio interrupt control register 0 (tioir0) tio interrupt control register 2 (tioir2) top interrupt control register 3 (topir3) tio interrupt control register 1 (tioir1) tms interrupt control register (tmsir) tin interrupt control register 0 (tinir0) tin interrupt control register 2 (tinir2) tin interrupt control register 4 (tinir4) tin interrupt control register 6 (tinir6) tin interrupt control register 1 (tinir1) tin interrupt control register 3 (tinir3) tin interrupt control register 5 (tinir5) top0 counter (top0ct) top0 reload register (top0rl) top0 correction register (top0cc) top1 counter (top1ct) address h'0080 0252 h'0080 0254 h'0080 0260 h'0080 0262 h'0080 0264 h'0080 0266 top1 reload register (top1rl) top1 correction register (top1cc) h'0080 0256 top2 counter (top2ct) top2 reload register (top2rl) top2 correction register (top2cc) top3 counter (top3ct) top3 reload register (top3rl) top3 correction register (top3cc) h'0080 0270 h'0080 0272 h'0080 0274 h'0080 0276 h'0080 0280 h'0080 0282 h'0080 0284 h'0080 0286 top4 counter (top4ct) top4 reload register (top4rl) top4 correction register (top4cc) top5 counter (top5ct) top5 reload register (top5rl) h'0080 0290 h'0080 0292 h'0080 0294 h'0080 0216 h'0080 021c h'0080 0218 h'0080 021a tin input processing control register 2 (tincr2) tin input processing control register 3 (tincr3) tin input processing control register 4 (tincr4) tin interrupt control register 7 (tinir7) blank addresses are reserved areas. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-15 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.7 register mapping of the sfr area (4) top5 correction register (top5cc) +0 address +1 address d0 d7 d8 d15 h'0080 029e h'0080 02a0 h'0080 02a2 h'0080 02a4 h'0080 02a6 top6 counter (top6ct) top6 reload register (top6rl) top6 correction register (top6cc) h'0080 02b0 h'0080 02b2 h'0080 02b4 top7 counter (top7ct) top7 reload register (top7rl) top7 correction register (top7cc) h'0080 02c0 h'0080 02c2 h'0080 02c4 h'0080 02c6 top8counter (top8ct) top8 reload register (top8rl) top8 correction register (top8cc) h'0080 02b6 h'0080 02a8 h'0080 02aa top6, 7 control register (top67cr) address h'0080 02d0 h'0080 02d2 h'0080 02d4 h'0080 02d6 top9 counter (top9ct) top9 reload register (top9rl) top9 correction register (top9cc) top10 counter (top10ct) top10 reload register (top10rl) top10 correction register (top10cc) h'0080 02e0 h'0080 02e2 h'0080 02e4 h'0080 02e6 h'0080 02e8 h'0080 02ea top8-10 control register (top810cr) top0-10 external enable register (topeen) top0-10 enable protect register (toppro) top0-10 count enable register (topcen) h'0080 02fa h'0080 02fc h'0080 02fe h'0080 0300 tio0 counter (tio0ct) tio0 reload register (tio0rl) tio0 reload 0/measure register (tio0rl0) tio1 counter (tio1ct) tio1 reload register (tio1rl) tio1 reload 0/measure register (tio1rl0) tio0-3 control register 0 (tio03cr0) h'0080 0302 h'0080 0304 h'0080 0306 h'0080 0310 h'0080 0312 h'0080 0314 h'0080 0316 h'0080 0318 h'0080 031a top0-5 control register 0 (top05cr0) top0-5 control register 1 (top05cr1) h'0080 0296 h'0080 0298 h'0080 029a h'0080 029c blank addresses are reserved areas. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-16 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.8 register mapping of the sfr area (5) +0 address +1 address d0 d7 d8 d15 h'0080 0324 h'0080 0326 tio2 reload 1 register (tio2rl1) tio2 reload 0/measure register (tio2rl0) h'0080 0330 h'0080 0332 h'0080 0334 h'0080 0336 tio3 counter (tio3ct) tio3 reload 1 register (tio3rl1) tio3 reload 0/measure register (tio3rl0) h'0080 0340 h'0080 0342 h'0080 0344 address tio4 counter (tio4ct) tio4 reload 1 register (tio4rl1) tio4 reload 0/measure register (tio4rl0) tio4 control register (tio4cr) tio5 control register (tio5cr) tio5 counter (tio5ct) tio5 reload 1 register (tio5rl1) tio5 reload 0/measure register (tio5rl0) h'0080 0346 h'0080 0348 h'0080 034a h'0080 0350 h'0080 0352 h'0080 0354 h'0080 0356 tio6 counter (tio6ct) tio6 reload 1 register (tio6rl1) tio6 reload 0/measure register (tio6rl0) tio6 control register (tio6cr) tio7 control register (tio7cr) h'0080 0360 h'0080 0362 h'0080 0364 h'0080 0366 h'0080 0368 h'0080 036a h'0080 0370 h'0080 0372 h'0080 0374 h'0080 0376 tio7 counter (tio7ct) tio7 reload 1 register (tio7rl1) tio7 reload 0/measure register (tio7rl0) h'0080 0380 h'0080 0382 h'0080 0384 h'0080 0386 h'0080 0388 h'0080 038a tio8 counter (tio8ct) tio8 reload 1 register (tio8rl1) tio8 reload 0/measure register (tio8rl0) tio8 control register (tio8cr) tio9 control register (tio9cr) h'0080 0390 h'0080 0392 h'0080 0394 h'0080 0396 tio9 counter (tio9ct) tio9 reload 1 register (tio9rl1) tio9 reload 0/measure register (tio9rl0) tio0-3 control register 1 (tio03cr1) tio2 counter (tio2ct) h'0080 031c h'0080 0320 h'0080 0322 blank addresses are reserved areas. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-17 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.9 register mapping of the sfr area (6) d0 d7 d8 d15 tms0 counter (tms0ct) tms0 measure 3 register (tms0mr3) tms0 measure 2 register (tms0mr2) tms0 measure 1 register (tms0mr1) h'0080 03c0 h'0080 03c2 h'0080 03c4 h'0080 03c6 tms0 measure 0 register (tms0mr0) tms0 control register (tms0cr) tms1 control register (tms1cr) tms1 counter (tms1ct) tms1 measure 3 register (tms1mr3) tms1 measure 2 register (tms1mr2) tms1 measure 1 register (tms1mr1) tms1 measure 0 register (tms1mr0) h'0080 03c8 h'0080 03ca h'0080 03d0 h'0080 03d2 h'0080 03d4 h'0080 03d6 h'0080 03d8 h'0080 03e0 h'0080 03e2 h'0080 03ea h'0080 03f0 h'0080 03f2 h'0080 03f4 h'0080 03f6 h'0080 03f8 h'0080 03fa h'0080 03fc tml0 counter, high (tml0cth) tml0 counter, low (tml0ctl) tml0 measure 3 register, high (tml0mr3h) tml0 measure 3 register, low (tml0mr3l) tml0 measure 2 register, high (tml0mr2h) tml0 measure 2 register, low (tml0mr2l) tml0 measure 1 register, high (tml0mr1h) tml0 measure 1 register, low (tml0mr1l) tml0 measure 0 register, high (tml0mr0h) tml0 control register (tml0cr) h'0080 03fe tml0 measure 0 register, low (tml0mr0l) dma0-4 interrupt mask register (dm04itmk) dma0 channel control register (dm0cnt) dma0 transfer count register (dm0tct) dma0 source address register (dm0sa) dma0 destination address register (dm0da) dma1 channel control register (dm1cnt) dma1 transfer count register (dm1tct) dma1 source address register (dm1sa) dma1 destination address register (dm1da) h'0080 0412 h'0080 0414 h'0080 0416 h'0080 0418 h'0080 041a h'0080 041c h'0080 0410 h'0080 041e h'0080 0422 h'0080 0424 h'0080 0426 h'0080 0428 h'0080 0420 dma0-4 interrupt request status register (dm04itst) h'0080 0400 h'0080 0408 dma5-9 interrupt mask register (dm59itmk) dma5-9 interrupt request status register (dm59itst) dma5 channel control register (dm5cnt) dma5 transfer count register (dm5tct) dma5 source address register (dm5sa) dma5 destination address register (dm5da) dma6 channel control register (dm6cnt) dma6 transfer count register (dm6tct) h'0080 03be tio0-9 count enable register (tiocen) h'0080 042a h'0080 042c h'0080 042e dma6 source address register (dm6sa) dma6 destination address register (dm6da) h'0080 03bc tio0-9 enable protect register (tiopro) +0 address +1 address address blank addresses are reserved areas. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-18 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.10 register mapping of the sfr area (7) d0 d7 d8 d15 dma2 channel control register (dm2cnt) dma2 transfer count register (dm2tct) h'0080 0430 h'0080 0432 h'0080 0434 h'0080 0436 h'0080 0438 h'0080 043a h'0080 043c h'0080 043e h'0080 0442 h'0080 0444 h'0080 0446 h'0080 0448 h'0080 044a h'0080 044c h'0080 0440 h'0080 044e h'0080 0450 h'0080 0452 h'0080 0454 h'0080 0456 h'0080 0458 h'0080 045a h'0080 045c h'0080 045e h'0080 0460 h'0080 0464 h'0080 0466 h'0080 0462 dma2 source address register (dm2sa) dma2 destination address register (dm2da) dma3 channel control register (dm3cnt) dma3 transfer count register (dm3tct) dma3 source address register (dm3sa) dma3 destination address register (dm3da) dma4 channel control register (dm4cnt) dma4 transfer count register (dm4tct) dma4 source address register (dm4sa) dma4 destination address register (dm4da) dma0 software request generation register (dm0sri) dma1 software request generation register (dm1sri) dma2 software request generation register (dm2sri) dma3 software request generation register (dm3sri) dma7 channel control register (dm7cnt) dma7 transfer count register (dm7tct) dma7 source address register (dm7sa) dma7 destination address register (dm7da) dma8 channel control register (dm8cnt) dma8 transfer count register (dm8tct) dma8 source address register (dm8sa) dma8 destination address register (dm8da) dma9 channel control register (dm9cnt) dma9 transfer count register (dm9tct) dma9 source address register (dm9sa) dma9 destination address register (dm9da) dma4 software request generation register (dm4sri) dma5 software request generation register (dm5sri) dma6 software request generation register (dm6sri) dma7 software request generation register (dm7sri) dma8 software request generation register (dm8sri) dma9 software request generation register (dm9sri) h'0080 0468 h'0080 0470 h'0080 0474 h'0080 0476 h'0080 0472 h'0080 0478 h'0080 0700 p0 data register (p0data) p1 data register (p1data) p2 data register (p2data) p3 data register (p3data) p4 data register (p4data) p6 data register (p6data) p7 data register (p7data) h'0080 0702 h'0080 0704 h'0080 0706 h'0080 0708 h'0080 070a h'0080 070c p8 data register (p8data) p10 data register (p10data) p12 data register (p12data) p9 data register (p9data) p11data register (p11data) p13 data register (p13data) p20 data register (p20data) p18 data register (p18data) p16 data register (p16data) p14 data register (p14data) h'0080 070e h'0080 0710 h'0080 0712 h'0080 0714 p15 data register (p15data) p17 data register (p17data) p19 data register (p19data) p21 data register (p21data) blank addresses are reserved areas. +0 address +1 address address ~ ~ ~ ~ ~ ~ ~ ~
3 3-19 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.11 register mapping of the sfr area (8) +0 address +1 address d0 d7 d8 d15 p2 direction register (p2dir) p3 direction register (p3dir) p4 direction register (p4dir) p6 direction register (p6dir) p7 direction register (p7dir) p8 direction register (p8dir) p9 direction register (p9dir) p10 direction register (p10dir) p11 direction register (p11dir) p12 direction register (p12dir) p13 direction register (p13dir) p14 direction register (p14dir) p15 direction register (p15dir) h'0080 0724 h'0080 0722 h'0080 0728 h'0080 0726 h'0080 072c h'0080 072a h'0080 0730 h'0080 072e address h'0080 0746 h'0080 074a h'0080 0748 h'0080 074e h'0080 074c p6 operation mode register (p6mod) p7 operation mode register (p7mod) p8 operation mode register (p8mod) p9 operation mode register (p9mod) p10 operation mode register (p10mod) p11 operation mode register (p11mod) p12 operation mode register (p12mod) p13 operation mode register (p13mod) p14 operation mode register (p14mod) p15 operation mode register (p15mod) p16 direction register (p16dir) p17 direction register (p17dir) h'0080 0750 p16 operation mode register (p16mod) p17 operation mode register (p17mod) h'0080 078c tid0 counter (tid0ct) tid0 reload register (tid0rl) h'0080 078e h'0080 0790 tod0_0 counter (tod00ct) tod0_0 reload 1 register (tod00rl1) tod0_0 reload 0 register (tod00rl0) tod0_1 counter (tod01ct) tod0_1 reload 1 register (tod01rl1) tod0_0 reload 0 register (tod01rl0) tod0_2 counter (tod02ct) tod0_2 reload 1 register (tod02rl1) h'0080 0794 h'0080 0792 h'0080 0798 h'0080 0796 h'0080 079c h'0080 079a h'0080 07a0 h'0080 079e h'0080 07a4 h'0080 07a2 h'0080 0744 port input function enable register (pien) p22 data register (p22data) h'0080 0716 h'0080 0720 h'0080 0732 h'0080 0734 h'0080 0736 p18 direction register (p18dir) p20 direction register (p20dir) p22 direction register (p22dir) p19 direction register (p19dir) p21 direction register (p21dir) h'0080 0752 h'0080 0754 h'0080 0756 p18 operation mode register (p18mod) p20 operation mode register (p20mod) p22 operation mode register (p22mod) p19 operation mode register (p19mod) p21 operation mode register (p21mod) bus mode control register (busmodc) p0 direction register (p0dir) p1 direction register (p1dir) h'0080 077e h'0080 07a6 h'0080 07a8 h'0080 07aa tod0_2 reload 0 register (tod02rl0) tod0_3 counter (tod03ct) tod0_3 reload 1 register (tod03rl1) tod0_3 reload 0 register (tod03rl0) h'0080 07ac h'0080 07ae blank addresses are reserved areas. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-20 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.12 register mapping of the sfr area (9) d0 d7 d8 d15 tod0_7 reload 1 register (tod07rl1) h'0080 07cc h'0080 07ca h'0080 07d0 h'0080 07ce h'0080 07d4 h'0080 07d2 h'0080 07d8 h'0080 07d6 h'0080 07de h'0080 07e2 h'0080 07e0 h'0080 07e8 flash mode register (fmod) flash control register 1 (fcnt1) h'0080 07dc h'0080 07da tod0_7 reload 0 register (tod07rl0) prescaler register 3 (prs3) tid0 control & prescaler 3 enable register (tid0pres3en) tod0 interrupt mask register (tod0ima) tod0 interrupt status register (tod0ist) f/f protect register 2 (ffp2) f/f data register 2 (ffd2) tod0 control register (tod0cr) tod0 enable protect register (tod0pro) tod0 count enable register (tod0cen) h'0080 07e4 flash status register 1 (fstat1) flash control register 2 (fcnt2) flash control register 3 (fcnt3) flash control register 4 (fcnt4) tod0_4 counter (tod04ct) tod0_4 reload 1 register (tod04rl1) tod0_4 reload 0 register (tod04rl0) tod0_5 counter (tod05ct) tod0_5 reload 1 register (tod05rl1) tod0_5 reload 0 register (tod05rl0) tod0_6 counter (tod06ct) tod0_6 reload 1 register (tod06rl1) tod0_6 reload 0 register (tod06rl0) tod0_7 counter (tod07ct) h'0080 07b0 h'0080 07b4 h'0080 07b8 h'0080 07b6 h'0080 07bc h'0080 07ba h'0080 07be h'0080 07b2 h'0080 07c0 h'0080 07c4 h'0080 07c8 h'0080 07c6 h'0080 07c2 pseudo-flash l bank register 0 (felbank0) h'0080 07ea h'0080 0a00 h'0080 0a02 h'0080 0a10 h'0080 0a12 h'0080 0a14 h'0080 0a16 h'0080 0a20 h'0080 0a22 h'0080 0a24 pseudo-flash l bank register 1 (felbank1) sio45 interrupt status register (si45stat) sio45 receive interrupt cause select register (si45sel) sio45 interrupt mask register (si45mask) sio4 transmit control register (s4tcnt) sio4 receive control register (s4rcnt) sio4 transmit buffer register (s4txb) sio4 receive buffer register (s4rxb) sio4 transmit/receive mode register (s4mod) sio4 baud rate register (s4baur) sio5 transmit control register (s5rcnt) sio5 transmit/receive mode register (s5mod) sio5 transmit buffer register (s5txb) sio5 receive buffer register (s5rxb) h'0080 07ec pseudo-flash l bank register 2 (felbank2) pseudo-flash l bank register 3 (felbank3) h'0080 0a26 sio5 receive control register (s5rcnt) sio5 baud rate register (s5baur) h'0080 07ee pseudo-flash s bank register 0 (fesbank0) pseudo-flash s bank register 1 (fesbank1) h'0080 07f0 h'0080 07f2 h'0080 07e6 blank addresses are reserved areas. +0 address +1 address address ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-21 ver.0.10 figure 3.4.13 register mapping of the sfr area (10) address space 3.4 internal rom/sfr area d0 d7 d8 d15 10-bit a-d1 data register 9 (ad1dt9) h'0080 0aa2 h'0080 0aa0 h'0080 0aa6 h'0080 0aa4 h'0080 0aaa h'0080 0aa8 h'0080 0aae h'0080 0aac h'0080 0ad2 h'0080 0ad6 h'0080 0ad4 h'0080 0adc h'0080 0ad0 10-bit a-d1 data register 10 (ad1dt10) 8-bit a-d1 data register 0 (ad18dt0) 8-bit a-d1 data register 1 (ad18dt1) h'0080 0ad8 8-bit a-d1 data register 2 (ad18dt2) a-d1 successive approximation register (ad1sar) a-d1 comparate data register (ad1cmp) 10-bit a-d1 data register 1 (ad1dt1) 10-bit a-d1 data register 2 (ad1dt2) 10-bit a-d1 data register 3 (ad1dt3) 10-bit a-d1 data register 5 (ad1dt5) 10-bit a-d1 data register 6 (ad1dt6) 10-bit a-d1 data register 7 (ad1dt7) h'0080 0a82 h'0080 0a80 h'0080 0a84 h'0080 0a86 h'0080 0a8a h'0080 0a8c h'0080 0a92 h'0080 0a90 h'0080 0a94 h'0080 0a88 h'0080 0a96 h'0080 0a9a h'0080 0a9e h'0080 0a9c h'0080 0a98 h'0080 0ade h'0080 0ae2 h'0080 0ae4 h'0080 0ae8 h'0080 0aea h'0080 0aec h'0080 0aee h'0080 0b8c h'0080 0b8e h'0080 0b90 tid1 reload register (tid1rl) tod1_0 counter (tod10ct) a-d1 single mode register 0 (ad1sim0) a-d1 single mode register 1 (ad1sim1) a-d1 scan mode register 0 (ad1scm0) a-d1 scan mode register 1 (ad1scm1) 10-bit a-d1 data register 0 (ad1dt0) 10-bit a-d1 data register 4 (ad1dt4) 10-bit a-d1 data register 8 (ad1dt8) 10-bit a-d1 data register 11 (ad1dt11) 10-bit a-d1 data register 12 (ad1dt12) 10-bit a-d1 data register 13 (ad1dt13) 10-bit a-d1 data register 14 (ad1dt14) 10-bit a-d1 data register 15 (ad1dt15) h'0080 0ada h'0080 0ae0 h'0080 0ae6 8-bit a-d1 data register 3 (ad18dt3) 8-bit a-d1 data register 4 (ad18dt4) 8-bit a-d1 data register 5 (ad18dt5) 8-bit a-d1 data register 6 (ad18dt6) 8-bit a-d1 data register 7 (ad18dt7) 8-bit a-d1 data register 8 (ad18dt8) 8-bit a-d1 data register 9 (ad18dt9) 8-bit a-d1 data register 10 (ad18dt10) 8-bit a-d1 data register 11 (ad18dt11) 8-bit a-d1 data register 12 (ad18dt12) 8-bit a-d1 data register 13 (ad18dt13) 8-bit a-d1 data register 14 (ad18dt14) 8-bit a-d1 data register 15 (ad18dt15) tid1 counter (tid1ct) tod1_0 reload 1 register (tod10rl1) h'0080 0b92 h'0080 0b94 blank addresses are reserved areas. +0 address +1 address address ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-22 ver.0.10 figure 3.4.14 register mapping of the sfr area (11) address space 3.4 internal rom/sfr area +0 address +1 address d0 d7 d8 d15 tod1_5 counter (tod15ct) h'0080 0bb8 h'0080 0bb6 h'0080 0bbc h'0080 0bba h'0080 0bc0 h'0080 0bbe h'0080 0bc4 h'0080 0bc2 h'0080 0bca address h'0080 0bce h'0080 0bcc h'0080 0bd4 h'0080 0bc8 h'0080 0bd0 tod1_1 reload 0 register (tod11rl0) tod1_3 counter (tod13ct) tod1_3 reload 1 register (tod13rl1) tod1_4 counter (tod14ct) tod1_4 reload 1 register (tod14rl1) h'0080 0b98 h'0080 0b96 h'0080 0b9a h'0080 0b9c h'0080 0ba0 h'0080 0ba2 h'0080 0ba8 h'0080 0ba6 h'0080 0baa h'0080 0b9e h'0080 0bac h'0080 0bb0 h'0080 0bb4 h'0080 0bb2 h'0080 0bae h'0080 0bd6 h'0080 0bda h'0080 0bdc h'0080 0c8c h'0080 0c8e h'0080 0c90 h'0080 0c94 h'0080 0c96 h'0080 0c98 tom0_0 reload 0 register (tom00rl0) tom0_1 counter (tom01ct) tod1_2 reload 0 register (tod12rl0) tod1_3 reload 0 register (tod13rl0) tod1_4 reload 0 register (tod14rl0) tod1_5 reload 1 register (tod15rl1) tod1_5 reload 0 register (tod15rl0) tod1_6 counter (tod16ct) tod1_6 reload 1 register (tod16rl1) h'0080 0bd2 h'0080 0bd8 h'0080 0bde tod1 interrupt status register (tod1ist) f/f protect register 3 (ffp3) f/f data register 3 (ffd3) tod1 enable protect register (tod1pro) tod1 count enable register (tod1cen) tom0_0 reload 1 register (tom00rl1) h'0080 0ba4 h'0080 0bc6 h'0080 0c92 tod1_0 reload 0 register (tod10rl0) tod1_1 counter (tod11ct) tod1_1 reload 1 register (tod11rl1) tod1_2 counter (tod12ct) tod1_2 reload 1 register (tod12rl1) tod1_6 reload 0 register (tod16rl0) tod1_7 counter (tod17ct) tod1_7 reload 1 register (tod17rl1) tod1_7 reload 0 register (tod17rl0) tid1 control & prescaler 4 enable register (tid1prs4en) prescaler register 4 (prs4) tod1 interrupt mask register (tod1ima) tod1 control register (tod1cr) tid2 counter (tid2ct) tid2 reload register (tid2rl) tom0_0 counter (tom00ct) h'0080 0c9a h'0080 0c9c tom0_1 reload 1 register (tom01rl1) blank addresses are reserved areas. ~ ~ ~ ~
3 3-23 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.15 register mapping of the sfr area (12) d0 d7 d8 d15 tom0_6 counter (tom06ct) h'0080 0cc0 h'0080 0cbe h'0080 0cc4 h'0080 0cc2 h'0080 0cc8 h'0080 0cc6 h'0080 0ccc h'0080 0cca h'0080 0cd2 h'0080 0cd6 h'0080 0cd4 h'0080 0cdc h'0080 0cd0 h'0080 0cd8 tom0_2 reload 0 register (tom02rl0) tom0_4 counter (tom04ct) tom0_4 reload 1 register (tom04rl1) tom0_5 counter (tom05ct) tom0_5 reload 1 register (tom05rl1) h'0080 0ca0 h'0080 0c9e h'0080 0ca2 h'0080 0ca4 h'0080 0ca8 h'0080 0caa h'0080 0cb0 h'0080 0cae h'0080 0cb2 h'0080 0ca6 h'0080 0cb4 h'0080 0cb8 h'0080 0cbc h'0080 0cba h'0080 0cb6 h'0080 0cde h'0080 0fe0 h'0080 0fe2 h'0080 0ff0 h'0080 0ff2 h'0080 0ff6 h'0080 0ff8 h'0080 0ffa tml1 measure 1 register, high (tml1mr1h) tml1 measure 1 register, low (tml1mr1l) tom0_3 reload 0 register (tom03rl0) tom0_4 reload 0 register (tom04rl0) tom0_5 reload 0 register (tom05rl0) tom0_6 reload 1 register (tom06rl1) tom0_6 reload 0 register (tom06rl0) tom0_7 counter (tom07ct) tom0_7 reload 1 register (tom07rl1) h'0080 0cda tom0 interrupt status register (tom0ist) f/f protect register 4 (ffp4) f/f data register 4 (ffd4) tom0 count enable register (tom0cen) tom0 enable protect register (tom0pro) tml1 measure 2 register, low (tml1mr2l) h'0080 0cac h'0080 0cce h'0080 0ff4 tom0_1 reload 0 register (tom01rl0) tom0_2 counter (tom02ct) tom0_2 reload 1 register (tom02rl1) tom0_3 counter (tom03ct) tom0_3 reload 1 register (tom03rl1) tom0_7 reload 0 register (tom07rl0) tid2 control & prescaler 5 enable register (tid2prs5en) prescaler register 5 (prs5) tom0 interrupt mask register (tom0ima) tom0 control register (tom0cr) tml1 measure 3 register, high (tml1mr3h) tml1 counter, high (tml1cth) tml1 counter, low (tml1ctl) h'0080 0fea tml1 control register (tml1cr) tml1 measure 2 register, high (tml1mr2h) h'0080 0ffc h'0080 0ffe tml1 measure 0 register, high (tml1mr0h) tml1 measure 0 register, low (tml1mr0l) blank addresses are reserved areas. +0 address +1 address address tml1 measure 3 register, low (tml1mr3l) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
3 3-24 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.16 register mapping of the sfr area (13) d0 d7 d8 d15 h'0080 1034 h'0080 1032 h'0080 1038 h'0080 1036 h'0080 103c h'0080 103a h'0080 1054 h'0080 1058 h'0080 1056 h'0080 1052 h'0080 105a can0 configuration register (can0conf) can0 global mask register standard id0 (c0gmsks0) can0 local mask register a standard id0 (c0lmskas0) h'0080 1000 h'0080 1002 h'0080 1004 h'0080 1008 h'0080 100a h'0080 1010 h'0080 100e h'0080 1006 h'0080 1028 h'0080 102c h'0080 1030 h'0080 102e h'0080 102a h'0080 105c h'0080 100c h'0080 1050 can0 control register (can0cnt) can0 extension id register (can0extid) can0 time stamp count register (can0tstmp) can0 slot interrupt status register (can0slist) can0 message slot 3 control register (c0msl3cnt) can0 message slot 2 control register (c0msl2cnt) can0 message slot 4 control register (c0msl4cnt) can0 status register (can0stat) can0 receive error count register (can0rec) can0 transmit error count register (can0tec) can0 message slot 0 control register (c0msl0cnt) can0 message slot 1 control register (c0msl1cnt) can0 message slot 5 control register (c0msl5cnt) can0 message slot 7 control register (c0msl7cnt) can0 message slot 9 control register (c0msl9cnt) can0 message slot 11 control register (c0msl11cnt) can0 message slot 13 control register (c0msl13cnt) can0 message slot 15 control register (c0msl15cnt) can0 message slot 6 control register (c0msl6cnt) can0 message slot 8 control register (c0msl8cnt) can0 message slot 10 control register (c0msl10cnt) can0 message slot 12 control register (c0msl12cnt) can0 message slot 14 control register (c0msl14cnt) h'0080 1012 can0 error interrupt status register (can0erist) can0 error interrupt mask register (can0erimk) h'0080 1014 h'0080 1016 can0 baud rate prescaler (can0brp) h'0080 105e can0 global mask register standard id1 (c0gmsks1) can0 global mask register extended id0 (c0gmske0) can0 global mask register extended id1 (c0gmske1) can0 global mask register extended id2 (c0gmske2) can0 local mask register a standard id1 (c0lmskas1) can0 local mask register a extended id0 (c0lmskae0) can0 local mask register a extended id1 (c0lmskae1) can0 local mask register a extended id2 (c0lmskae2) can0 local mask register b standard id0 (c0lmskbs0) can0 local mask register b standard id0 (c0lmskbs1) can0 local mask register b extended id0 (c0lmskbe0) can0 local mask register b extended id0 (c0lmskbe1) can0 local mask register b extended id0 (c0lmskbe0) blank addresses are reserved areas. +0 address +1 address address can0 slot interrupt mask register (can0slimk) ~ ~ ~ ~ ~ ~ ~ ~
3 3-25 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.17 register mapping of the sfr area (14) d0 d7 d8 d15 h'0080 1102 h'0080 1104 h'0080 110c h'0080 110e h'0080 1112 h'0080 1114 h'0080 1116 h'0080 1110 h'0080 1108 h'0080 1106 h'0080 110a can0 message slot 0 extended id0 (c0msl0eid0) can0 message slot 0 extended id2 (c0msl0eid2) can0 message slot 0 data 0 (c0msl0dt0) can0 message slot 0 data 2 (c0msl0dt2) can0 message slot 0 data 4 (c0msl0dt4) can0 message slot 0 extended id1 (c0msl0eid1) can0 message slot 0 data length register (c0msl0dlc) can0 message slot 0 data 1 (c0msl0dt1) can0 message slot 0 data 3 (c0msl0dt3) can0 message slot 0 data 5 (c0msl0dt5) can0 message slot 0 data 6 (c0msl0dt6) can0 message slot 0 data 7 (c0msl0dt7) can0 message slot 0 time stamp (c0msl0tsp) can0 message slot 1 standard id0 (c0msl1sid0) can0 message slot 1 extended id0 (c0msl1eid0) can0 message slot 1 extended id2 (c0msl1eid2) can0 message slot 1 data 0 (c0msl1dt0) can0 message slot 1 standard id1 (c0msl1sid1) can0 message slot 1 extended id1 (c0msl1eid1) can0 message slot 1 data length register (c0msl1dlc) can0 message slot 1 data 1 (c0msl1dt1) can0 message slot 1 data 3 (c0msl1dt3) can0 message slot 1 data 5 (c0msl1dt5) can0 message slot 1 data 2 (c0msl1dt2) can0 message slot 1 data 4 (c0msl1dt4) h'0080 1118 h'0080 111a h'0080 111e h'0080 1120 h'0080 1122 h'0080 1126 h'0080 1128 h'0080 112e h'0080 112c h'0080 1124 h'0080 112a can0 message slot 2 data 6 (c0msl2dt6) can0 message slot 2 time stamp (c0msl2tsp) can0 message slot 2 data 7 (c0msl2dt7) h'0080 111c can0 message slot 2 data 4 (c0msl2dt4) can0 message slot 2 data 2 (c0msl2dt2) can0 message slot 2 data 0 (c0msl2dt0) can0 message slot 2 extended id2 (c0msl2eid2) can0 message slot 2 extended id0 (c0msl2eid0) can0 message slot 2 standard id0 (c0msl2sid0) can0 message slot 1 time stamp (c0msl1tsp) can0 message slot 1 data 6 (c0msl1dt6) can0 message slot 2 data 5 (c0msl2dt5) can0 message slot 2 data 3 (c0msl2dt3) can0 message slot 2 data 1 (c0msl2dt1) can0 message slot 2 data length register (c0msl2dlc) can0 message slot 2 extended id1 (c0msl2eid1) can0 message slot 2 standard id1 (c0msl2sid1) can0 message slot 1 data 7 (c0msl1dt7) h'0080 1130 h'0080 1132 h'0080 1136 h'0080 1138 h'0080 113e h'0080 113c h'0080 1134 h'0080 113a can0 message slot 3 data 6 (c0msl3dt6) can0 message slot 3 time stamp (c0msl3tsp) can0 message slot 3 data 7 (c0msl3dt7) can0 message slot 3 data 4 (c0msl3dt4) can0 message slot 3 data 2 (c0msl3dt2) can0 message slot 3 data 0 (c0msl3dt0) can0 message slot 3 extended id2 (c0msl3eid2) can0 message slot 3 extended id0 (c0msl3eid0) can0 message slot 3 standard id0 (c0msl3sid0) can0 message slot 3 data 5 (c0msl3dt5) can0 message slot 3 data 3 (c0msl3dt3) can0 message slot 3 data 1 (c0msl3dt1) can0 message slot 3 data length register (c0msl3dlc) can0 message slot 3 extended id1 (c0msl3eid1) can0 message slot 3 standard id1 (c0msl3sid1) h'0080 1140 h'0080 1142 h'0080 1146 h'0080 1148 h'0080 114e h'0080 114c h'0080 1144 h'0080 114a can0 message slot 4 data 6 (c0msl4dt6) can0 message slot 4 time stamp (c0msl4tsp) can0 message slot 4 data 7 (c0msl4dt7) can0 message slot 4 data 4 (c0msl4dt4) can0 message slot 4 data 2 (c0msl4dt2) can0 message slot 4 data 0 (c0msl4dt0) can0 message slot 4 extended id2 (c0msl4eid2) can0 message slot 4 extended id0 (c0msl4eid0) can0 message slot 4 standard id0 (c0msl4sid0) can0 message slot 4 data 5 (c0msl4dt5) can0 message slot 4 data 3 (c0msl4dt3) can0 message slot 4 data 1 (c0msl4dt1) can0 message slot 4 data length register (c0msl4dlc) can0 message slot 4 extended id1 (c0msl4eid1) can0 message slot 4 standard id1 (c0msl4sid1) h'0080 1150 h'0080 1152 can0 message slot 5 extended id0 (c0msl5eid0) can0 message slot 5 standard id0 (c0msl5sid0) can0 message slot 5 extended id1 (c0msl5eid1) can0 message slot 5 standard id1 (c0msl5sid1) h'0080 1100 can0 message slot 0 standard id1 (c0msl0sid1) can0 message slot 0 standard id0 (c0msl0sid0) blank addresses are reserved areas. +0 address +1 address address
3 3-26 ver.0.10 address space 3.4 internal rom/sfr area figure 3.4.18 register mapping of the sfr area (15) d0 d7 d8 d15 h'0080 1156 h'0080 1158 h'0080 115e h'0080 115c h'0080 1154 h'0080 115a h'0080 1160 h'0080 1162 h'0080 1166 h'0080 1168 h'0080 116e h'0080 116c h'0080 1164 h'0080 116a h'0080 1170 h'0080 1172 h'0080 1176 h'0080 1174 can0 message slot 5 data 6 (c0msl5dt6) can0 message slot 5 time stamp (c0msl5tsp) can0 message slot 5 data 7 (c0msl5dt7) can0 message slot 5 data 4 (c0msl5dt4) can0 message slot 5 data 2 (c0msl5dt2) can0 message slot 5 data 0 (c0msl5dt0) can0 message slot 5 extended id2 (c0msl5eid2) can0 message slot 5 data 5 (c0msl5dt5) can0 message slot 5 data 3 (c0msl5dt3) can0 message slot 5 data 1 (c0msl5dt1) can0 message slot 5 data length register (c0msl5dlc) can0 message slot 6 data 6 (c0msl6dt6) can0 message slot 6 time stamp (c0msl6tsp) can0 message slot 6 data 7 (c0msl6dt7) can0 message slot 6 data 4 (c0msl6dt4) can0 message slot 6 data 2 (c0msl6dt2) can0 message slot 6 data 0 (c0msl6dt0) can0 message slot 6 extended id2 (c0msl6eid2) can0 message slot 6 extended id0 (c0msl6eid0) can0 message slot 6 standard id0 (c0msl6sid0) can0 message slot 6 data 5 (c0msl6dt5) can0 message slot 6 data 3 (c0msl6dt3) can0 message slot 6 data 1 (c0msl6dt1) can0 message slot 6 data length register (c0msl6dlc) can0 message slot 6 extended id1 (c0msl6eid1) can0 message slot 6 standard id1 (c0msl6sid1) can0 message slot 7 data 0 (c0msl7dt0) can0 message slot 7 extended id2 (c0msl7eid2) can0 message slot 7 extended id0 (c0msl7eid0) can0 message slot 7 standard id0 (c0msl7sid0) can0 message slot 7 data 1 (c0msl7dt1) can0 message slot 7 data length register (c0msl7dlc) can0 message slot 7 extended id1 (c0msl7eid1) can0 message slot 7 standard id1 (c0msl7sid1) h'0080 117a h'0080 117c h'0080 117e h'0080 1182 h'0080 1184 h'0080 118a h'0080 1188 h'0080 1180 h'0080 1186 h'0080 1178 h'0080 118c h'0080 118e h'0080 1192 h'0080 1194 h'0080 119a h'0080 1198 h'0080 1190 h'0080 1196 h'0080 119c h'0080 119e can0 message slot 8 data 6 (c0msl8dt6) can0 message slot 8 time stamp (c0msl8tsp) can0 message slot 8 data 7 (c0msl8dt7) can0 message slot 8 data 4 (c0msl8dt4) can0 message slot 8 data 2 (c0msl8dt2) can0 message slot 8 data 0 (c0msl8dt0) can0 message slot 8 extended id2 (c0msl8eid2) can0 message slot 8 extended id0 (c0msl8eid0) can0 message slot 8 standard id0 (c0msl8sid0) can0 message slot 8 data 5 (c0msl8dt5) can0 message slot 8 data 3 (c0msl8dt3) can0 message slot 8 data 1 (c0msl8dt1) can0 message slot 8 data length register (c0msl8dlc) can0 message slot 8 extended id1 (c0msl8 eid1) can0 message slot 8 standard id1 (c0msl8sid1) can0 message slot 7 data 6 (c0msl7dt6) can0 message slot 7 time stamp (c0msl7tsp) can0 message slot 7 data 7 (c0msl7dt7) can0 message slot 7 data 4 (c0msl7dt4) can0 message slot 7 data 2 (c0msl7dt2) can0 message slot 7 data 5 (c0msl7dt5) can0 message slot 7 data 3 (c0msl7dt3) can0 message slot 9 data 6 (c0msl9dt6) can0 message slot 9 time stamp (c0msl9tsp) can0 message slot 9 data 7 (c0msl9dt7) can0 message slot 9 data 4 (c0msl9dt4) can0 message slot 9 data 2 (c0msl9dt2) can0 message slot 9 data 0 (c0msl9dt0) can0 message slot 9 extended id2 (c0msl9eid2) can0 message slot 9 extended id0 (c0msl9eid0) can0 message slot 9 standard id0 (c0msl9sid0) can0 message slot 9 data 5 (c0msl9dt5) can0 message slot 9 data 3 (c0msl9dt3) can0 message slot 9 data 1 (c0msl9dt1) can0 message slot 9 data length register (c0msl9dlc) can0 message slot 9 extended id1 (c0msl9eid1) can0 message slot 9 standard id1 (c0msl9sid1) h'0080 11a2 h'0080 11a4 h'0080 11a0 can0 message slot 10 extended id2 (c0msl10eid2) can0 message slot 10 extended id0 (c0msl10eid0) can0 message slot 10 standard id0 (c0msl10sid0) can0 message slot 10 data length register (c0msl10dlc) can0 message slot 10 extended id1 (c0msl10eid1) can0 message slot 10 standard id1 (c0msl10sid1) h'0080 11a6 can0 message slot 10 data 0 (c0msl10dt0) can0 message slot 10 data 1 (c0msl10dt1) blank addresses are reserved areas. +0 address +1 address address
3 3-27 ver.0.10 figure 3.4.19 register mapping of the sfr area (16) address space 3.4 internal rom/sfr area d0 d7 d8 d15 h'0080 11aa h'0080 11a8 h'0080 11ac h'0080 11ae h'0080 11b2 h'0080 11bc h'0080 11ba h'0080 11b8 h'0080 11b0 h'0080 11b6 h'0080 11be h'0080 11c2 h'0080 11c4 h'0080 11ca h'0080 11c8 h'0080 11c0 h'0080 11c6 h'0080 11ce h'0080 11d2 h'0080 11d0 can0 message slot 10 data 6 (c0msl10dt6) can0 message slot 10 time stamp (c0msl10tsp) can0 message slot 10 data 7 (c0msl10dt7) can0 message slot 10 data 4 (c0msl10dt4) can0 message slot 10 data 2 (c0msl10dt2) can0 message slot 10 data 5 (c0msl10dt5) can0 message slot 10 data 3 (c0msl10dt3) can0 message slot 11 data 6 (c0msl11dt6) can0 message slot 11 time stamp (c0msl11tsp) can0 message slot 11 data 7 (c0msl11dt7) can0 message slot 11 data 4 (c0msl11dt4) can0 message slot 11 data 2 (c0msl11dt2) can0 message slot 11 data 0 (c0msl11dt0) can0 message slot 11 extended id2 (c0msl11eid2) can0 message slot 11 extended id0 (c0msl11eid0) can0 message slot 11 standard id0 (c0msl11sid0) can0 message slot 11 data 5 (c0msl11dt5) can0 message slot 11 data 3 (c0msl11dt3) can0 message slot 11 data 1 (c0msl11dt1) can0 message slot 11 data length register (c0msl11dlc) can0 message slot 11 extended id1 (c0msl11eid1) can0 message slot 11 standard id1 (c0msl11sid1) can0 message slot 12 data 6 (c0msl12dt6) can0 message slot 12 time stamp (c0msl12tsp) can0 message slot 12 data 7 (c0msl12dt7) can0 message slot 12 data 4 (c0msl12dt4) can0 message slot 12 data 2 (c0msl12dt2) can0 message slot 12 data 0 (c0msl12dt0) can0 message slot 12 extended id2 (c0msl12eid2) can0 message slot 12 extended id0 (c0msl12eid0) can0 message slot 12 standard id0 (c0msl12sid0) can0 message slot 12 data 5 (c0msl12dt5) can0 message slot 12 data 3 (c0msl12dt3) can0 message slot 12 data 1 (c0msl12dt1) can0 message slot 12 data length register (c0msl12dlc) can0 message slot 12 extended id1 (c0msl12eid1) can0 message slot 12 standard id1 (c0msl12sid1) can0 message slot 13 extended id0 (c0msl13eid0) can0 message slot 13 standard id0 (c0msl13sid0) can0 message slot 13 extended id1 (c0msl13eid1) can0 message slot 13 standard id1 (c0msl13sid1) h'0080 11d6 h'0080 11d8 h'0080 11da h'0080 11de h'0080 11e0 h'0080 11e6 h'0080 11e4 h'0080 11dc h'0080 11e2 h'0080 11d4 h'0080 11e8 h'0080 11ea h'0080 11ee h'0080 11f0 h'0080 11f6 h'0080 11f4 h'0080 11ec h'0080 11f2 h'0080 11f8 h'0080 11fa h'0080 11fe h'0080 3ffe h'0080 11fc can0 message slot 14 data 6 (c0msl14dt6) can0 message slot 14 time stamp (c0msl14tsp) can0 message slot 14 data 7 (c0msl14dt7) can0 message slot 14 data 4 (c0msl14dt4) can0 message slot 14 data 2 (c0msl14dt2) can0 message slot 14 data 0 (c0msl14dt0) can0 message slot 14 extended id2 (c0msl14eid2) can0 message slot 14 extended id0 (c0msl14eid0) can0 message slot 14 standard id0 (c0msl14sid0) can0 message slot 14 data 5 (c0msl14dt5) can0 message slot 14 data 3 (c0msl14dt3) can0 message slot 14 data 1 (c0msl14dt1) can0 message slot 14 data length register (c0msl14dlc) can0 message slot 14 extended id1 (c0msl14eid1) can0 message slot 14 standard id1 (c0msl14sid1) can0 message slot 13 data 6 (c0msl13dt6) can0 message slot 13 time stamp (c0msl13tsp) can0 message slot 13 data 7 (c0msl13dt7) can0 message slot 13 data 4 (c0msl13dt4) can0 message slot 13 data 2 (c0msl13dt2) can0 message slot 13 data 0 (c0msl13dt0) can0 message slot 13 extended id2 (c0msl13eid2) can0 message slot 13 data 5 (c0msl13dt5) can0 message slot 13 data 3 (c0msl13dt3) can0 message slot 13 data 1 (c0msl13dt1) can0 message slot 15 data 6 (c0msl15dt6) can0 message slot 15 time stamp (c0msl11tsp) can0 message slot 15 data 7 (c0msl15dt7) can0 message slot 15 data 4 (c0msl15dt4) can0 message slot 15 data 2 (c0msl15dt2) can0 message slot 15 data 0 (c0msl15dt0) can0 message slot 15 extended id2 (c0msl15eid2) can0 message slot 15 extended id0 (c0msl15eid0) can0 message slot 15 standard id0 (c0msl15sid0) can0 message slot 15 data 5 (c0msl15dt5) can0 message slot 15 data 3 (c0msl15dt3) can0 message slot 15 data 1 (c0msl15dt1) can0 message slot 15 data length register (c0msl15dlc) can0 message slot 15 extended id1 (c0msl15eid1) can0 message slot 15 standard id1 (c0msl15sid1) can0 message slot 13 data length register (c0msl13dlc) h'0080 11cc h'0080 11b4 blank addresses are reserved areas. +0 address +1 address address ~ ~ ~ ~
3 3-28 ver.0.10 address space 3.5 eit vector entry 3.5 eit vector entry the eit vector entry is located at the beginning of the internal rom/extended external areas. instructions for branching to the start addresses of respective eit event handlers are written here. note that it is branch instructions and not the jump addresses that are written here. for details, refer to chapter 4, "eit." figure 3.5.1 eit vector entry note: when flash entry bit = 1 (i.e., flash enable mode), the ei vector entry is at h'0080 4000. h'0000 0040 trap0 trap1 trap2 trap3 trap4 trap5 trap6 trap7 trap8 trap9 trap10 trap11 trap12 trap13 trap14 trap15 ae (address exception) ei (external interrupt) (note) h'0000 0044 h'0000 0048 h'0000 004c h'0000 0050 h'0000 0054 h'0000 0058 h'0000 005c h'0000 0060 h'0000 0064 h'0000 0068 h'0000 006c h'0000 0070 h'0000 0074 h'0000 0078 h'0000 007c h'0000 0080 ri (reset interrupt) sbi (system break interrupt) rie (reserved instruction exception) h'0000 0030 h'0000 0020 h'0000 0010 h'0000 0000 031 h'0000 0034 h'0000 0038 h'0000 003c h'0000 0024 h'0000 0028 h'0000 002c h'0000 0004 h'0000 0008 h'0000 000c h'0000 0014 h'0000 0018 h'0000 001c ~ ~
3 3-29 ver.0.10 3.6 icu vector table the icu vector table is used by the internal interrupt controller. the start addresses of interrupt handlers for the interrupt requests from respective internal peripheral i/os are set at the ad- dresses shown below. for details, refer to chapter 5, "interrupt controller." the 32170's icu vector table is shown in figures 3.6.1 and 3.6.2. address space 3.6 icu vector table figure 3.6.1 icu vector table of the 32170 (1/2) h'0000 0094 address d0 d7 +0 address +1 address d8 d15 h'0000 0096 mjt input interrupt 4 handler start address (a0-a15) mjt input interrupt 4 handler start address (a16-a31) h'0000 0098 h'0000 009a h'0000 009c h'0000 009e h'0000 00a0 h'0000 00a2 h'0000 00a4 h'0000 00a6 h'0000 00a8 h'0000 00aa h'0000 00ac h'0000 00ae h'0000 00b0 h'0000 00b2 h'0000 00b4 h'0000 00b6 h'0000 00b8 h'0000 00ba h'0000 00bc h'0000 00be h'0000 00c0 h'0000 00c2 h'0000 00c4 h'0000 00c6 mjt output interrupt 7 handler start address (a0-a15) mjt output interrupt 7 handler start address (a16-a31) mjt input interrupt 3 handler start address (a0-a15) mjt input interrupt 3 handler start address (a16-a31) mjt input interrupt 2 handler start address (a0-a15) mjt input interrupt 2 handler start address (a16-a31) mjt input interrupt 1 handler start address (a0-a15) mjt input interrupt 1 handler start address (a16-a31) mjt input interrupt 0 handler start address (a0-a15) mjt input interrupt 0 handler start address (a16-a31) mjt output interrupt 6 handler start address (a0-a15) mjt output interrupt 6 handler start address (a16-a31) mjt output interrupt 5 handler start address (a0-a15) mjt output interrupt 5 handler start address (a16-a31) mjt output interrupt 4 handler start address (a0-a15) mjt output interrupt 4 handler start address (a16-a31) mjt output interrupt 3 handler start address (a0-a15) mjt output interrupt 3 handler start address (a16-a31) mjt output interrupt 2 handler start address (a0-a15) mjt output interrupt 2 handler start address (a16-a31) mjt output interrupt 1 handler start address (a0-a15) mjt output interrupt 1 handler start address (a16-a31) mjt output interrupt 0 handler start address (a0-a15) mjt output interrupt 0 handler start address (a16-a31) ~ ~
3 3-30 ver.0.10 address space 3.6 icu vector table figure 3.6.2 icu vector table of the 32170 (2/2) h'0000 00c8 address d0 d7 +0 address +1 address d8 d15 h'0000 00ca dma0-4 interrupt handler start address (a0-a15) dma0-4 interrupt handler start address (a16-a31) h'0000 00cc h'0000 00ce h'0000 00d0 h'0000 00d2 h'0000 00d4 h'0000 00d6 h'0000 00d8 h'0000 00da h'0000 00dc h'0000 00de sio1 receive interrupt handler start address (a0-a15) sio1 receive interrupt handler start address (a16-a31) sio1 transmit interrupt handler start address (a0-a15) sio1 transmit interrupt handler start address (a16-a31) a-d0 conversion interrupt handler start address (a0-a15) a-d0 conversion interrupt handler start address (a16-a31) h'0000 00e0 h'0000 00e2 h'0000 00e4 h'0000 00e6 h'0000 00e8 h'0000 00ea h'0000 00ec h'0000 00ee tid0 output interrupt handler start address (a0-a15) tid0 output transmit interrupt handler start address (a16-a31) tod0 output interrupt handler start address (a0-a15) tod0 output interrupt handler start address (a16-a31) dma5-9 interrupt handler start address (a0-a15) dma5-9 interrupt handler start address (a16-a31) sio2,3 transmit/receive interrupt handler start address (a0-a15) sio2,3 transmit/receive interrupt handler start address (a16-a31) h'0000 00f0 h'0000 00f2 rtd interrupt handler start address (a0-a15) rtd interrupt handler start address (a16-a31) h'0000 00f4 h'0000 00f6 tid1 output interrupt handler start address (a0-a15) tid1 output interrupt handler start address (a16-a31) h'0000 00f8 h'0000 00fa tod1+tom0 output interrupt handler start address (a0-a15) tod1+tom0 output interrupt handler start address (a16-a31) h'0000 00fc h'0000 00fe sio4,5 transmit/receive interrupt handler start address (a0-a15) sio4,5 transmit/receive interrupt handler start address (a16-a31) h'0000 0100 h'0000 0102 a-d1 conversion interrupt handler start address (a0-a15) a-d1 conversion interrupt handler start address (a16-a31) h'0000 0104 h'0000 0106 tid2 output interrupt handler start address (a0-a15) tid2 output interrupt handler start address (a16-a31) h'0000 0108 h'0000 010a tml1 input interrupt handler start address (a0-a15) tml1 input interrupt handler start address (a16-a31) h'0000 010c h'0000 010e can0 transmit/receive & error interrupt handler start address (a0-a15) can0 transmit/receive & error interrupt handler start address (a16-a31) sio0 receive interrupt handler start address (a0-a15) sio0 receive interrupt handler start address (a16-a31) sio0 transmit interrupt handler start address (a0-a15) sio0 transmit interrupt handler start address (a16-a31)
3 3-31 ver.0.10 address space 3.7 notes on address space 3.7 note about address space ? virtual flash emulation function the 32170 has a special function, called the "virtual flash emulation function," which allows the internal ram to be mapped in blocks of 8 kbytes from the beginning (up to four blocks for the m32170f6, up to three blocks for the m32170f4 and m32170f3) into internal flash memory areas divided in 8 kbytes (l banks). similarly, this function allows the internal ram to be mapped in blocks of 4 kbytes, for the m32170f6 (up to two blocks) starting from the ram address h'0080 c000, for the m32170f4 and m32170f3 (up to two blocks) starting from the ram address h'0080 a000 into internal flash memory areas divided in 4 kbytes (s banks). for details about this function, refer to section 6.7, "pseudo-flash emulation function."
3 3-32 ver.0.10 address space 3.7 notes on address space j this is a blank page. j
chapter 4 chapter 4 eit 4.1 outline of eit 4.2 eit event 4.3 eit processing procedure 4.4 eit processing mechanism 4.5 acceptance of eit events 4.6 saving and restoring the pc and psw 4.7 eit vector entry 4.8 exception processing 4.9 interrupt processing 4.10 trap processing 4.11 eit priority levels 4.12 example of eit processing
4 4-2 ver.0.10 eit 4.1 outline of eit 4.1 outline of eit if some event occurs when the cpu is executing an ordinary program, it may become necessary to suspend the program being executed and execute another program. events like this one are referred to by a generic name as eit (exception, interrupt, and trap). (1) exception this is an event related to the context being executed. it is generated by an error or violation during instruction execution. in the m32r/e, this type of event includes address exception (ae) and reserved instruction exception (rie). (2) interrupt this is an event generated irrespective of the context being executed. it is generated in hardware by a signal from an external source. in the m32r/e, this type of event includes external interrupt (ei), system break interrupt (sbi), and reset interrupt (ri). (3) trap this refers to a software interrupt generated by executing a trap instruction. this type of event is intentionally generated in a program as in the os's system call by the programmer. eit exception reserved instruction exception (rie) address exception (ae) interrupt reset interrupt (ri) system break interrupt (sbi) external interrupt (ei) trap trap figure 4.1.1 classification of eits
4 4-3 ver.0.10 eit 4.2 eit event 4.2 eit event 4.2.1 exception (1) reserved instruction exception (rie) reserved instruction exception (rie) is generated when execution of a reserved instruction (unimplemented instruction) is detected. (2) address exception (ae) address exception (ae) is generated when an attempt is made to access a misaligned address in load or store instructions. 4.2.2 interrupt (1) reset interrupt (ri) ____________ reset interrupt (ri) is always accepted by entering the reset signal. the reset interrupt is assigned the highest priority. (2) system break interrupt (sbi) system break interrupt (sbi) is an emergency interrupt which is used when power outage is detected or a fault condition is notified by an external watchdog timer. this interrupt can only be used in cases when after interrupt processing, control will not return to the program that was being executed when the interrupt occurred. (3) external interrupt (ei) external interrupt (ei) is requested from internal peripheral i/os managed by the interrupt controller. the 32170's internal interrupt controller manages these interrupts by assigning each one of eight priority levels including an interrupt-disabled state. 4.2.3 trap traps are software interrupts which are generated by executing the trap instruction. sixteen distinct vector addresses are provided corresponding to trap instruction operands 0-15.
4 4-4 ver.0.10 4.3 eit processing procedure eit processing consists of two parts, one in which they are handled automatically by hardware, and one in which they are handled by user-created programs (eit handlers). the procedure for processing eits when accepted, except for a rest interrupt, is shown below. figure 4.3.1 outline of eit processing procedure instruction a instruction b instruction c pc bpc psw (b)psw eit vector entry eit handlers except for sbi rte instruc- tion instruction c instruction d program suspended eit request accepted instruction processing- canceled type (rie, ae) instruction processing -completed type (ei, trap) program execution restarted eit request generated hardware preprocessing bpc, (b)psw, and general-purpose registers saved to stack branch instruc -tion general-purpose registers, (b)psw, and bpc restored from stack sbi (system break interrupt processing) hardware postprocessing (sbi) program terminated or system is reset user-created eit handler (b)psw psw bpc pc processing by handler note: (b)psw denotes the bpsw field of the psw register. eit 4.3 eit processing procedure
4 4-5 ver.0.10 when an eit is accepted, the m32r/e saves the pc and psw (as will be described later) and branches to the eit vector. the eit vector has an entry address assigned for each eit. this is where the bra (branch) instruction (note that these are not branch address) for the eit handler is written. in the m32r/e's hardware preprocessing, only the contents of the pc and psw registers are transferred to the backup registers (bpc register and the bpsw field of the psw register), and no other operations are performed. therefore, please make sure the bpc register, the psw register (including the bpsw field), and the general-purpose registers to be used in the eit handler are saved to the stack by the eit handler you write. (remember that these registers must be saved to the stack in a program by the user.) when processing by the eit handler is completed, restore the saved registers from the stack and finally execute the "rte" instruction. control is thereby returned from eit processing to the program that was being executed when the eit occurred. (this does not apply to the system break interrupt, however.) in the m32r/e's hardware postprocessing, the contents of the backup registers (bpc register and the bpsw field of the psw register) are moved back to the pc and psw registers. eit 4.3 eit processing procedure
4 4-6 ver.0.10 4.4 eit processing mechanism the m32r/e's eit processing mechanism consists of the m32r cpu core and the interrupt controller for internal peripheral i/os. it also has the backup registers for the pc and psw (bpc register and the bpsw field of the psw register). the m32r/e's internal eit processing mechanism is shown below. figure 4.4.1 the m32r/e's eit processing mechanism interrupt controller (icu) sbi ei internal peripheral i/o reset ri ae, rie, trap ie flag (psw) m32r cpu core sbi low high priority sbi ei ri m32r/e psw register psw bpsw bpc register pc register eit 4.4 eit processing mechanism
4 4-7 ver.0.10 4.5 acceptance of eit event when an eit event occurs, the m32r/e suspends the program it has hitherto been executing and branches to eit processing by the relevant handler. conditions under which each eit event occurs and the timing at which they are accepted are shown below. table 4.5.1 acceptance of eit events eit event type of processing acceptance timing values set in bpc register reserved instruction instruction processing - during instruction pc value of the instruction exception (rie) canceled type execution which generated rie address exception (ae) instruction processing - during instruction pc value of the instruction canceled type execution which generated ae reset interrupt (ri) instruction processing- each machine cycle indeterminate value aborted type system break instruction processing- break in instructions pc value of the next instruction interrupt (sbi) completed type (only word boundaries) external interrupt (ei) instruction processing- break in instructions pc value of the next instruction completed type (only word boundaries) trap (trap) instruction processing- break in instructions pc value of trap completed type instruction + 4 eit 4.5 acceptance of eit events
4 4-8 ver.0.10 4.6 saving and restoring the pc and psw the following describes operation of the m32r at the time when it accepts an eit and when it executes the "rte" instruction. (1) hardware preprocessing when an eit is accepted save the sm, ie, and c bits of the psw register bsm ? sm bie ? ie bc ? c update the sm, ie, and c bits of the psw register sm ? remains unchanged (rie, ae, trap) or set to 0 (sbi, ei, ri) ie ? set to 0 c ? set to 0 a save the pc register bpc ? pc ? set the vector address in the pc register branches to the eit vector and executes the branch instruction ("bra" instruction) written in it, thereby transferring control to the user-created eit handler. (2) hardware postprocessing when the "rte" instruction is executed ? restore the sm, ie, and c bits of the psw register from their backup bits. sm ? bsm ie ? bie c ? bc restore the value of the pc register from the bpc register pc ? bpc note: the value of the bpc register and those of the bsm, bie, and bc bits of the psw register after execution of the "rte" instruction are indeterminate. eit 4.6 saving and restoring the pc and psw
4 4-9 ver.0.10 figure 4.6.1 saving and restoring the pc and psw a a a a psw bpc pc when eit is accepted when "rte" instruction is executed 2 3 4 1 2 1 aaaa aaaa aaaa aaaa 1 2 save sm, ie, and c bits bsm bie bc sm ie c update sm, ie, and c bits sm ie c unchanged/0 0 0 3 4 save pc bpc pc set vector address in pc pc vector address restore pc value from bpc the value of bpc after execution of the "rte" instruction is indeterminate. 2 1 restore bsm, bie, and bc bits from backup bits sm ie c the values of bsm, bie, and bc bits after execution of the "rte" instruction are indeterminate. bsm bie bc 16 17 23 24 25 31(lsb) 15 8 7 0(msb) sm ie c bc bsm bie 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 psw bpsw field psw field eit 4.6 saving and restoring the pc and psw
4 4-10 ver.0.10 4.7 eit vector entry the eit vector entry is located in the user space starting from address h'0000 0000. the table below lists the eit vector entry. table 4.7.1 eit vector entry note 1: during boot mode, this vector address is moved to the beginning of the boot rom (address h'8000 0000). for details, refer to section 6.5, "programming of internal flash memory." note 2: during flash e/w enable mode, this vector address is moved to the beginning of the internal ram (address h'0080 4000). for details, refer to section 6.5, "programming of internal flash memory." name abbreviation vector address sm ie bpc reset interrupt ri h'0000 0000 (note 1) 0 0 indeterminate system break interrupt sbi h'0000 0010 0 0 pc of the next instruction reserved instruction rie h'0000 0020 indeterminate 0 pc of the instruction that exception generated eit address exception ae h'0000 0030 indeterminate 0 pc of the instruction that generated rie trap trap0 h'0000 0040 indeterminate 0 pc of trap instruction + 4 trap1 h'0000 0044 indeterminate 0 pc of trap instruction + 4 trap2 h'0000 0048 indeterminate 0 pc of trap instruction + 4 trap3 h'0000 004c indeterminate 0 pc of trap instruction + 4 trap4 h'0000 0050 indeterminate 0 pc of trap instruction + 4 trap5 h'0000 0054 indeterminate 0 pc of trap instruction + 4 trap6 h'0000 0058 indeterminate 0 pc of trap instruction + 4 trap7 h'0000 005c indeterminate 0 pc of trap instruction + 4 trap8 h'0000 0060 indeterminate 0 pc of trap instruction + 4 trap9 h'0000 0064 indeterminate 0 pc of trap instruction + 4 trap10 h'0000 0068 indeterminate 0 pc of trap instruction + 4 trap11 h'0000 006c indeterminate 0 pc of trap instruction + 4 trap12 h'0000 0070 indeterminate 0 pc of trap instruction + 4 trap13 h'0000 0074 indeterminate 0 pc of trap instruction + 4 trap14 h'0000 0078 indeterminate 0 pc of trap instruction + 4 trap15 h'0000 007c indeterminate 0 pc of trap instruction + 4 external interrupt ei h'0000 0080 (note 2) 0 0 pc of the next instruction eit 4.7 eit vector entry
4 4-11 ver.0.10 4.8 exception processing 4.8.1 reserved instruction exception (rie) [occurrence conditions] reserved instruction exception (rie) is generated when execution of a reserved instruction (unimplemented instruction) is detected. instruction check is performed on the op-code part of the instruction. when a reserved instruction exception occurs, the instruction which generated it is not executed. if an external interrupt is requested at the same time a reserved instruction exception is detected, it is the reserved instruction exception that is accepted. [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits C the bsm, bie, and bc bits. bsm ? sm bie ? ie bc ? c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. sm ? unchanged bie ? 0 bc ? 0 (3) saving pc the pc value of the instruction that generated the reserved instruction exception is set in the bpc register. for example, if the instruction that generated the reserved instruction exception is at address 4, the value 4 is set in the bpc register. similarly, if the instruction is at address 6, the value 6 is set in the bpc register. in this case, the value of the bpc register bit 30 indicates whether the instruction that generated the reserved instruction exception resides on a word boundary (bpc[30] = 0) or not on a word boundary (bpc[30] = 1). however, in either case of the above, the address to which the "rte" instruction returns after completion of processing by the eit handler is address 4. (this is because the two low-order bits are cleared to "00" when returning to the pc.) eit 4.8 exception processing
4 4-12 ver.0.10 figure 4.8.1 example of a return address for reserved instruction exception (rie) (4) branching to the eit vector entry control branches to the address h'0000 0020 in the user space. this is the last operation performed in hardware preprocessing by the m32r/e. (5) jumping from the eit vector entry to the user-created handler the m32r/e executes the "bra" instruction written at address h'0000 0020 of the eit vector entry by the user to jump to the start address of the user-created handler. at the beginning of the eit handler you created, first save the bpc and psw registers and the necessary general-purpose registers to the stack. (6) returning from the eit handler at the end of the eit handler, restore the general-purpose registers and the bpc and psw registers from the stack and then execute the "rte" instruction. as you execute the "rte" instruction, hardware postprocessing is automatically performed by the m32r/e. h'00 address rie occurred h'04 h'08 h'0c +0 +1 +2 +3 h'00 address rie occurred h'04 h'08 h'0c +0 +1 +2 +3 return address return address bpc h'06 bpc h'04 ~ ~ ~ ~ ~ ~ ~ ~ eit 4.8 exception processing
4 4-13 ver.0.10 4.8.2 address exception (ae) [occurrence conditions] address exception (ae) is generated when an attempt is made to access a misaligned address in load or store instructions. the following lists the combination of instructions and accessed addresses that may cause address exceptions to occur: ? when the ldh, lduh, or sth instruction accesssed an address whose two low-order bits are "01" or "11" ? when the ld, st, lock, or unlock instruction accessed an address whose two low-order bits are "01," "10," or "11" when an address exception occurs, memory access by the instruction that generated the exception is not performed. if an external interrupt is requested at the same time an address exception is detected, it is the address exception that is accepted. [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits C the bsm, bie, and bc bits. bsm ? sm bie ? ie bc ? c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. sm ? unchanged ie ? 0 c ? 0 (3) saving pc the pc value of the instruction that generated the address exception is set in the bpc register. for example, if the instruction that generated the address exception is at address 4, the value 4 is set in the bpc register. similarly, if the instruction is at address 6, the value 6 is set in the bpc register. in this case, the value of the bpc register bit 30 indicates whether the instruction that generated the address exception resides on a word boundary (bpc[30] = 0) or not on a word boundary (bpc[30] = 1). however, in either case of the above, the address to which the "rte" instruction returns after completion of processing by the eit handler is address 4. (this is because the two low-order bits are cleared to "00" when returning to the pc.) eit 4.8 exception processing
4 4-14 ver.0.10 figure 4.8.2 example of a return address for address exception (ae) (4) branching to the eit vector entry control branches to the address h'0000 0030 in the user space. this is the last operation performed in hardware preprocessing by the m32r/e. (5) jumping from the eit vector entry to the user-created handler the m32r/e executes the "bra" instruction written at address h'0000 0030 of the eit vector entry by the user to jump to the start address of the user-created handler. at the beginning of the eit handler you created, first save the bpc and psw registers and the necessary general-purpose registers to the stack. (6) returning from the eit handler at the end of the eit handler, restore the general-purpose registers and the bpc and psw registers from the stack and then execute the "rte" instruction. as you execute the "rte" instruction, hardware postprocessing is automatically performed by the m32r/e. h'00 address ae occurred h'04 h'08 h'0c +0 +1 +2 +3 h'00 address ae occurred h'04 h'08 h'0c +0 +1 +2 +3 return address return address bpc h'06 bpc h'04 ~ ~ ~ ~ ~ ~ ~ ~ eit 4.8 exception processing
4 4-15 ver.0.10 4.9 interrupt processing 4.9.1 reset interrupt (ri) [occurrence conditions] ____________ reset interrupt (ri) is unconditionally accepted in any machine cycle by pulling the reset input signal low. the reset interrupt is assigned the highest priority among all eits. [eit processing] (1) initializing sm, ie, and c bits the sm, ie, and c bits of the psw register are initialized in the manner shown below. for the reset interrupt, the values of bsm, bie, and bc bits are indeterminate. sm ? 0 ie ? 0 c ? 0 (2) branching to the eit vector entry control branches to the address h'0000 0000 in the user space. however, when operating in boot mode, control goes to the beginning of the boot rom (address h'8000 0000). for details, refer to section 6.5, "programming of internal flash memory." (3) jumping from the eit vector entry to the user program the m32r/e executes the instruction written at address h'0000 0000 of the eit vector entry by the user. in the reset vector entry, be sure to initialize the psw and spi registers before jumping to the start address of the program you created. eit 4.9 interrupt processing
4 4-16 ver.0.10 4.9.2 system break interrupt (sbi) system break interrupt (sbi) is an emergency interrupt which is used when power outage is detected or a fault condition is notified by an external watchdog timer. the system break interrupt cannot be masked by the psw register ie bit. therefore, the system break interrupt can only be used when some fatal event has already occurred to the system when the interrupt is detected. also, this interrupt must be used on condition that after processing by the sbi handler, control will not return to the program that was being executed when the system break interrupt occurred. [occurrence conditions] _______ a system break interrupt is accepted by a falling edge on sbi input pin. (the system break interrupt cannot be masked by the psw register ie bit.) in no case will a system break interrupt be activated immediately after executing a 16-bit instruction that starts from a word boundary. (for 16-bit branch instructions, however, the interrupt may be accepted immediately after branching.) figure 4.9.1 timing at which system break interrupt (sbi) is accepted 16-bit instruction order in which instructions are executed address 1000 interrupt may be accepted interrupt cannot be accepted address 1002 address 1004 address 1008 16-bit instruction 32-bit instruction interrupt may be accepted interrupt may be accepted eit 4.9 interrupt processing
4 4-17 ver.0.10 [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits-the bsm, bie, and bc bits. bsm ? sm bie ? ie bc ? c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. sm ? 0 ie ? 0 c ? 0 (3) saving pc the content (always word boundary) of the pc register is saved to the bpc register. (4) branching to the eit vector entry control branches to the address h'0000 0010 in the user space. this is the last operation performed in hardware preprocessing by the m32r/e. (5) jumping from the eit vector entry to the user-created handler the m32r/e executes the "bra" instruction written at address h'0000 0010 of the eit vector entry by the user to jump to the start address of the user-created handler. the system break interrupt can only be used when some fatal event has occurred to the system. also, this interrupt must be used on condition that after processing by the sbi handler, control will not return to the program that was being executed when the system break interrupt occurred. eit 4.9 interrupt processing
4 4-18 ver.0.10 4.9.3 external interrupt (ei) an external interrupt is generated upon an interrupt request which is output by the 32170's internal interrupt controller. the interrupt controller manages interrupt requests by assigning each one of seven priority levels. for details, refer to chapter 5, "interrupt controller." for details about the interrupt sources, refer to each section in which the relevant internal peripheral i/o is described. [occurrence conditions] external interrupts are managed based on interrupt requests from each internal peripheral i/o by the 32170's internal interrupt controller. these interrupt requests are notified to the m32r cpu by the interrupt controller. the m32r/e checks these interrupt requests at a break in instructions residing on word boundaries, and when an interrupt request is detected and the psw register ie flag = 1, accepts it as an external interrupt. in no case will an external interrupt be activated immediately after executing a 16-bit instruction that starts from a word boundary. (for 16-bit branch instructions, however, the interrupt may be accepted immediately after branching.) figure 4.9.2 timing at which external interrupt (ei) is accepted 16-bit instruction order in which instructions are executed address 1000 interrupt may be accepted interrupt cannot be accepted address 1002 address 1004 address 1008 16-bit instruction 32-bit instruction interrupt may be accepted interrupt may be accepted eit 4.9 interrupt processing
4 4-19 ver.0.10 [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits C the bsm, bie, and bc bits. bsm ? sm bie ? ie bc ? c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. sm ? 0 ie ? 0 c ? 0 (3) saving pc the content (always word boundary) of the pc register is saved to the bpc register. (4) branching to the eit vector entry control branches to the address h'0000 0080 in the user space. however, when operating in flash e/w enable mode, control goes to the beginning of the internal ram (address h'0080 4000). (for details, refer to section 6.5, "writing to internal flash memory.") this is the last operation performed in hardware preprocessing by the m32r/e. (5) jumping from the eit vector entry to the user-created handler the m32r/e executes the "bra" instruction written at address h'0000 0080 of the eit vector entry by the user to jump to the start address of the user-created handler. at the beginning of the eit handler you created, first save the bpc and psw registers and the necessary general-purpose registers to the stack. (6) returning from the eit handler at the end of the eit handler, restore the general-purpose registers and the bpc and psw registers from the stack and then execute the "rte" instruction. as you execute the "rte" instruction, hardware postprocessing is automatically performed by the m32r/e. eit 4.9 interrupt processing
4 4-20 ver.0.10 4.10 trap processing 4.10.1 trap (trap) [occurrence conditions] traps refer to software interrupts which are generated by executing the "trap" instruction. sixteen distinct traps are generated, each corresponding to one of "trap" instruction operands 0-15. accordingly, sixteen vector entries are provided. [eit processing] (1) saving sm, ie, and c bits the sm, ie, and c bits of the psw register are saved to their backup bits C the bsm, bie, and bc bits. bsm ? sm bie ? ie bc ? c (2) updating sm, ie, and c bits the sm, ie, and c bits of the psw register are updated as shown below. unchanged sm ? 0 ie ? 0 c ? 0 (3) saving pc when the trap instruction is executed, the "pc value of the trap instruction + 4" is set in the bpc register. for example, if the "trap" instruction is located at address 4, the value h'08 is set in the bpc register. similarly, if the instruction is located at address 6, the value h'0a is set in the bpc register. in this case, the value of the bpc register bit 30 indicates whether the trap instruction resides on a word boundary (bpc[30] = 0) or not on a word boundary (bpc[30] = 1). however, in either case of the above, the address to which the "rte" instruction returns after completion of processing by the eit handler is address 8. (this is because the two low-order bits are cleared to "00" when returning to the pc.) normally, when the program has been written in assembler, the halfword that immediately follows the "trap" instruction placed at a word boundary has the "nop" instruction automatically inserted by the assembler. eit 4.10 trap processing
4 4-21 ver.0.10 figure 4.10.1 example of a return address for trap (trap) (4) branching to the eit vector entry control branches to the addresses h'0000 0040 through h'0000 007c in the user space. this is the last operation performed in hardware preprocessing by the m32r/e. (5) jumping from the eit vector entry to the user-created handler the m32r/e executes the "bra" instruction written at addresses h'0000 0040 through h'0000 007c of the eit vector entry by the user to jump to the start address of the user- created handler. at the beginning of the eit handler you created, first save the bpc and psw registers and the necessary general-purpose registers to the stack. (6) returning from the eit handler at the end of the eit handler, restore the general-purpose registers and the bpc and psw registers from the stack and then execute the "rte" instruction. as you execute the "rte" instruction, hardware postprocessing is automatically performed by the m32r/e. h'00 h'04 h'08 h'0c +0 +1 +2 +3 h'00 h'04 h'08 h'0c +0 +1 +2 +3 bpc h'0a bpc h'08 address trap occurred return address ~ ~ ~ ~ return address address trap occurred ~ ~ ~ ~ eit 4.10 trap processing
4 4-22 ver.0.10 4.11 eit priority levels the table below lists the priority levels of eit events. when multiple eits occur simultaneously, the event with the highest priority is accepted first. table 4.11.1 priority of eit events and how returned from eit note that for external interrupt (ei), the priority levels of interrupt requests from each peripheral i/o are set by the 32170's internal interrupt controller. for details, refer to chapter 5, "interrupt controller." priority eit event type of processing values set in bpc register 1(highest) reset interrupt (ri) instruction processing indeterminate -aborted type address exception (ae) instruction processing- pc of the instruction that canceled type generated ae 2 reserved instruction instruction processing- pc of the instruction that exception (rie) canceled type generated ae trap (trap) instruction processing- trap instruction + 4 completed type 3 system break instruction processing- pc of the next instruction interrupt (sbi) completed type 4 external interrupt (ei) instruction processing- pc of the next instruction completed type eit 4.11 eit priority levels
4 4-23 ver.0.10 4.12 example of eit processing (1) when rie, ae, sbi, ei, or trap occurs singly figure 4.12.1 processing of events when rie, ae, sbi, ei, or trap occurs singly (2) when rie, ae, or trap and ei occurs simultaneously figure 4.12.2 processing of events when rie, ae, or trap and ei occurs simultaneously rte instruction ie=0 ie=1 bpc register = return address a ie=1 rie, ae, sbi, ei, or trap occurrs singly return address a: if ie = 0, no events but reset and sbi are accepted :eit handler rie, ae, or trap is accepted first bpc register = return address a rie, ae, or trap and ei occurs simultaneously ei is accepted next bpc register = return address a rte instruction ie=0 ie=1 ie=1 return address a: :eit handler ie=0 ie=1 rte instruction eit 4.12 example of eit processing
4 4-24 ver.0.10 figure 4.12.3 example of eit processing bra instruction rte eit handler eit vector entry program being executed save bpc to stack save psw to stack save general-purpose registers to stack processing by eit handler restore general- purpose registers restore psw restore bpc eit event occurs (sbi) system break interrupt processing program terminated or system reset (any event other than sbi) pc bpc psw (b)psw hardware preprocessing hardware postprocessing (b)psw psw bpc pc aa aa aaa aa ~ ~ ~ ~ eit 4.12 example of eit processing
chapter 5 chapter 5 interrupt controller (icu) 5.1 outline of the interrupt controller (icu) 5.2 interrupt sources of internal peripheral i/os 5.3 icu-related registers 5.4 icu vector table 5.5 description of interrupt operation 5.6 description of system break interrupt (sbi) operation
5 5-2 ver.0.10 interrupt controller (icu) 5.1 outline of the interrupt controller (icu) 5.1 outline of interrupt controller (icu) the interrupt controller (icu) manages maskable interrupts from internal peripheral i/os and a system break interrupt (sbi). the maskable interrupts from internal peripheral i/os are notified to the m32r cpu as external interrupts (ei). there are a total of 31 interrupt sources for the maskable interrupts from internal peripheral i/os, which are managed by assigning them one of eight priority levels including an interrupt-disabled state. when multiple interrupt requests of the same priority level occur simultaneously, their priorities are resolved by predetermined hardware priority. the source of an interrupt request generated in internal peripheral i/os is identified by reading the relevant interrupt status register provided for internal peripheral i/os. on the other hand, the system break interrupt (sbi) is recognized when a low-going transition _______ occurs on the sbi signal input pin. this interrupt is used for emergency purposes such as when power outage is detected or a fault condition is notified by an external watchdog timer, so that it is always accepted irrespective of the psw register ie bit status. when the icu has finished servicing an sbi, terminate or reset the system without returning to the program that was being executed when the interrupt occurred. specifications of the interrupt controller are outlined in the table below. table 5.1.1 outline of interrupt controller (icu) item specification interrupt source maskable interrupt from internal peripheral i/o : 31 sources system break interrupt : 1 source (entered from sbi pin) level management eight levels including an interrupt-disabled state (however, interrupts of the same level have their priorities resolved by fixed hardware priority.)
5 5-3 ver.0.10 interrupt controller (icu) 5.1 outline of the interrupt controller (icu) figure 5.1.1 block diagram of the interrupt controller interrupt vector register( ivect) interrupt mask register (imask) new_imask maskable interrupt request generated priority resolution by fixed hardware priority imask compar- ed ilevel priority resolution by interrupt priority levels set . . . . . . . system break interrupt request generated sbi ei sbi interrupt controller interrupt control register sbi control register (sbicr) sbireq ireq ireq ireq ireq ireq ireq peripheral circuits edge- recognized interrupt control circuit level- recognized interrupt request interrupt request interrupt request to the cpu core . . . . . . . . . edge- recognized edge- recognized level- recognized level- recognized interrupt control circuit interrupt control circuit to the cpu core
5 5-4 ver.0.10 5.2 interrupt sources of internal peripheral i/os the interrupt controller receives as its inputs the interrupt requests from mjt (multijunction timer), dmac, serial i/o, a-d converter, rtd, and can. for details about these interrupts, refer to each section in which the relevant internal peripheral i/o is described. table 5.2.1 interrupt sources of internal peripheral i/os (1/2) interrupt cause contents number of input icu type of input sources source(note) a-d0 conversion interrupt 1 edge-recognized a-d1 conversion interrupt 1 edge-recognized sio0 transmit interrupt 1 edge-recognized sio0 receive interrupt 1 edge-recognized sio1transmit interrupt 1 edge-recognized sio1 receive interrupt 1 edge-recognized sio2,3 transmit/receive 4 level-recognized interrupt sio4,5 transmit/receive 4 level-recognized interrupt tid0 output interrupt 1 edge-recognized tid1 output interrupt 1 edge-recognized tid2 output interrupt 1 edge-recognized tod0 output interrupt 8 level-recognized tod1 + tom0 output 16 level-recognized interrupt tml1 input interrupt 4 level-recognized rtd interrupt 1 edge-recognized dma transfer interrupt 0 5 level-recognized dma transfer interrupt 1 5 level-recognized can0 transmit/receive 5 level-recognized & error interrupt note: icu type of input source ? edge-recognized: interrupt requests are generated on a falling edge of the interrupt signal applied to the icu. ? level-recognized: interrupt requests are generated when the interrupt signal applied to the icu is held low. for these level-recognized interrupts, the icu's interrupt control register irq bit cannot be set or cleared in software. single-shot conversion in a-d0 converter scan mode completed, single mode completed, or comparator mode completed single-shot conversion in a-d1 converter scan mode completed, single mode completed, or comparator mode completed sio0 transmit buffer empty interrupt sio0 reception completed or receive error interrupt sio1 transmit buffer empty interrupt sio1 reception completed or receive error interrupt sio2, 3 reception completed or receive error interrupt transmit buffer empty interrupt sio4, 5 reception completed or receive error interrupt transmit buffer empty interrupt tid0 output tid1 output tid2 output tod0_0 to tod0_7 output tod1_0 to tod1_7 output + tom0_0 to tom0_7 output tml1 input (tin30 to tin33 input) rtd interrupt generation command dma0-4 transfer completed dma5-9 transfer completed can0 transmission completed, can0 reception completed, can0 error passive, can0 error bus-off, can0 bus error interrupt controller (icu) 5.2 interrupt sources of internal peripheral i/os
5 5-5 ver.0.10 table 5.2.2 interrupt sources of internal peripheral i/os (2/2) interrupt source content number of input icu type of input sources source (note) mjt output interrupt 7 mjt output interrupt group 7 (tms0, tms1 output) 2 level-recognized mjt output interrupt 6 mjt output interrupt group 6 (top8, top9 output) 2 level-recognized mjt output interrupt 5 mjt output interrupt group 5 (top10 output) 1 edge-recognized mjt output interrupt 4 mjt output interrupt group 4 (tio4 - tio7 output) 4 level-recognized mjt output interrupt 3 mjt output interrupt group 3 (tio8, tio9 output) 2 level-recognized mjt output interrupt 2 mjt output interrupt group 2 (top0 - top5 output) 6 level-recognized mjt output interrupt 1 mjt output interrupt group 1 (top6, top7 output) 2 level-recognized mjt output interrupt 0 mjt output interrupt group 0 (tio0 - tio3 output) 4 level-recognized mjt input interrupt 4 mjt input interrupt group 4 (tin3-tin6 input) 4 level-recognized mjt input interrupt 3 mjt input interrupt group 3 (tin20-tin23 input) 4 level-recognized mjt input interrupt 2 mjt input interrupt group 2 (tin12-tin19 input) 8 level-recognized mjt input interrupt 1 mjt input interrupt group 1 (tin0-tin2 input) 3 level-recognized mjt input interrupt 0 mjt input interrupt group 0 (tin7-tin11 input) 5 level-recognized note: icu type of input source ? edge-recognized: interrupt requests are generated on a falling edge of the interrupt signal applied to the icu. ? level-recognized: interrupt requests are generated when the interrupt signal applied to the icu is held low. for these level-recognized interrupts, the icu's interrupt control register irq bit cannot be set or cleared in software. interrupt controller (icu) 5.2 interrupt sources of internal peripheral i/os
5 5-6 ver.0.10 5.3 icu-related registers the diagram below shows a map of the interrupt controller (icu)'s related registers. figure 5.3.1 interrupt controller (icu) related register map interrupt controller (icu) 5.3 icu-related registers h'0080 0000 address d0 d7 +0 address +1 address d8 d15 h'0080 0004 h'0080 0006 h'0080 0066 h'0080 0068 aaaaaaa aaaaaaa interrupt mask register (imask) sbi control register (sbicr) h'0080 006a h'0080 006c h'0080 006e h'0080 0070 h'0080 0072 h'0080 0074 h'0080 0076 h'0080 0078 aaaaaaa h'0080 0002 h'0080 007a h'0080 007c h'0080 007e a-d0 conversion interrupt control register (iad0ccr) sio0 receive interrupt control register (isio0rxcr) sio1 receive interrupt control register (isio1rxcr) sio1 transmit interrupt control register (isio1txcr) sio0 transmit interrupt control register (isio0txcr) dma0-4 interrupt control register (idma04cr) mjt output interrupt control register 0 (imjtocr0) mjt output interrupt control register 2 (imjtocr2) mjt output interrupt control register 4 (imjtocr4) mjt output interrupt control register (imjtocr6) mjt output interrupt control register (imjtocr1) mjt output interrupt control register 3 (imjtocr3) mjt output interrupt control register5 (imjtocr5) mjt output interrupt control register7 (imjtocr7) mjt input interrupt control register 0 (imjticr0) mjt input interrupt control register 1 (imjticr1) mjt input interrupt control register 2 (imjticr2) mjt input interrupt control register 3 (imjticr3) mjt input interrupt control register 4 (imjticr4) tid1 output interrupt control register (itid1cr) sio2,3 transmit/receive interrupt control register (isio23cr) rtd interrupt control register (irtdcr) dma5-9 interrupt control register (idma59cr) tod0 output interrupt control register (itod0cr) tid0 output interrupt control register (itid0cr) interrupt vector register (ivect) note: the registers in the thick frames must always be accessed in halfwords. h'0080 0060 can0 transmit/receive & error interrupt control register (ican0cr) tml1 input interrupt control register (itml1cr) h'0080 0062 tid2 output interrupt control register (itid2cr) a-d1 conversion interrupt control register (iad1ccr) h'0080 0064 sio4,5 transmit/receive interrupt control register (isio45cr) tod1+tom0 output interrupt control register (itom0cr) blank addresses are reserved for future use. ~ ~ ~ ~
5 5-7 ver.0.10 5.3.1 interrupt vector register n interrupt vector register (ivect) d bit name function r w 0 C 15 ivect (16 low-order when an interrupt is accepted, the 16 low-order bits C bits of icu vector in icu vector table address for the accepted table address) interrupt source is stored in this register. note: this register must always be accessed in halfwords. the interrupt vector register (ivect) is used when an interrupt is accepted to store the 16 low- order bits of icu vector table address for the accepted interrupt source. before this function can work, the icu vector table (addresses h'0000 0094 through h'0000 010f) must have set in it the start addresses of interrupt handlers for each internal peripheral i/o. when an interrupt is accepted, the 16 low-order bits of icu vector table address for the accepted interrupt source is stored in this ivect register. the eit handler reads out the content of the ivect register by the "ldh" instruction to acquire the icu vector table address. when the ivect register is read out, operations (1) to (4) below are automatically performed in hardware: (1) the accepted new imask (new_imask) is set in the imask register. (2) the accepted interrupt request is cleared (not cleared for level-recognized interrupt sources). (3) the interrupt request (ei) to the cpu core is cleared. (4) the icu's internal sequencer is activated to start internal processing (interrupt priority resolution). note that the interrupt vector register (ivect) can only be read out by the eit handler (psw register ie bit being disabled). also, make sure that in the eit handler, the interrupt mask register (imask) is read out before reading out the ivect register. caution d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 ivect interrupt controller (icu) 5.3 icu-related registers
5 5-8 ver.0.10 5.3.2 interrupt mask register n interrupt mask register (imask) the interrupt mask register (imask) is used to finally determine whether an interrupt request can be accepted after comparing its priority with the priority levels that have been set for each interrupt source (by setting the interrupt control register ilevel bits). when the interrupt vector register (ivect) described above is read out, a new mask value (new_imask) is set in this imask register. when any value is written to the imask register, operations (1) to (2) below are automatically performed in hardware: (1) the interrupt request (ei) to the cpu core is cleared. (2) the icu's internal sequencer is activated to start internal processing (interrupt priority resolution). note that the interrupt mask register (imask) can only be read out by the eit handler (psw register ie bit being disabled). d bit name function r w 0 C 4 no functions assigned 0 C 5C 7 imask (interrupt mask) 000 : maskable interrupts are disabled 001 : level 0 interrupts can be accepted 010 : level 0-1 interrupts can be accepted 011 : level 0-2 interrupts can be accepted 100 : level 0-3 interrupts can be accepted 101 : level 0-4 interrupts can be accepted 110 : level 0-5 interrupts can be accepted 111 : level 0-6 interrupts can be accepted d0123456d7 imask interrupt controller (icu) 5.3 icu-related registers caution
5 5-9 ver.0.10 5.3.3 sbi (system break interrupt) control register n sbi (system break interrupt) control register w = : writable for only clearing operation (see the description below) _______ the sbi (system break interrupt) is an interrupt generated by a falling edge on sbi signal input pin. when an sbi occurs, the sbi control register's sbireq (sbi request) bit is set to 1. the sbireq bit cannot be set in software. to clear the sbireq bit after being set, perform the operation described below. (be careful not to clear this bit when no sbi request has been generated.) ? write a 1 and then a 0 to sbireq. d bit name function r w 0 C 6 no functions assigned 0 C 7 sbi req (sbi request) 0 : sbi is not requested 1 : sbi is requested d0123456d7 sbireq interrupt controller (icu) 5.3 icu-related registers
5 5-10 ver.0.10 5.3.4 interrupt control registers n can0 transmit/receive & error interrupt control register (ican0cr) n tml1 interrupt control register (itml1cr) n tid2 output interrupt control register (itid2cr) n a-d1 converter interrupt control register (iad1ccr) n sio4,5 transmit/receive interrupt control register (isio45cr) n tod1+tom0 output interrupt control register (itom0cr) n tid1 output interrupt control register (itid1cr) n rtd interrupt control register (irtdcr) n sio2,3 transmit/receive interrupt control register (isio23cr) n dma5-9 interrupt control register (idma59cr) n tod0 output interrupt control register (itod0cr) n tid0 output interrupt control register (itid0cr) n a-d0 converter interrupt control register (iad0ccr) n sio0 transmit interrupt control register (isio0txcr) n sio0 receive interrupt control register (isio0rxcr) n sio1 transmit interrupt control register (isio1txcr) n sio1 receive interrupt control register (isio1rxcr) n dma0-4 interrupt control register (idma04cr) n mjt output interrupt control register 0 (imjtocr0) n mjt output interrupt control register 1 (imjtocr1) n mjt output interrupt control register 2 (imjtocr2) n mjt output interrupt control register 3 (imjtocr3) n mjt output interrupt control register 4 (imjtocr4) n mjt output interrupt control register 5 (imjtocr5) n mjt output interrupt control register 6 (imjtocr6) n mjt output interrupt control register 7 (imjtocr7) n mjt input interrupt control register 0 (imjticr0) n mjt input interrupt control register 1 (imjticr1) n mjt input interrupt control register 2 (imjticr2) n mjt input interrupt control register 3 (imjticr3) n mjt input interrupt control register 4 (imjticr4) interrupt controller (icu) 5.3 icu-related registers
5 5-11 ver.0.10 w= : can be set and cleared only when the type of input source is "edge-recognized" type (with only one interrupt source being input). (1) ireq (interrupt request) bit (d3 or d11) when an interrupt request from some internal peripheral i/o occurs, the corresponding ireq (interrupt request) bit is set to 1. this bit can be set and cleared in software for only edge-recognized interrupt sources (and not for level-recognized interrupt sources). also, when the ireq bit is set by an interrupt request generated by an edge-recognized interrupt source, it is automatically cleared to 0 by reading out the interrupt vector register (ivect) (not cleared in the case of level-recognized interrupt sources). if the ireq bit is cleared in software at the same time it is set by an interrupt request generated, clearing in software has priority. also, if the ireq bit is cleared by reading out the ivect register at the same time it is set by an interrupt request generated, clearing by a read of ivect has priority. d bit name function r w 0 C 2 no functions assigned 0 C (8-10) 3 ireq (interrupt request) 0 : interrupt is not requested (11) 1 : interrupt is requested 4 no functions assigned 0 C (12) 5-7 ilevel (interrupt priority level) 000 : interrupt priority level 0 (13-15) 001 : interrupt priority level 1 010 : interrupt priority level 2 011 : interrupt priority level 3 100 : interrupt priority level 4 101 : interrupt priority level 5 110 : interrupt priority level 6 111 : interrupt priority level 7 (interrupt-disabled state) d0123456d7 ( d8 9 10 11 12 13 14 d15) ireq ilevel interrupt controller (icu) 5.3 icu-related registers
5 5-12 ver.0.10 figure 5.3.2 interrupt control register configuration (edge-recognized type) figure 5.3.3 interrupt control register configuration (level-recognized type) interrupt controller (icu) 5.3 icu-related registers interrupt priority resolving circuit interrupt request from each peripheral function interrupt enabled ilevel (levels 0-7) d3,11 data bus d5-7,13-15 3 f/f set set/clear ireq d3,11 d5-7,13-15 rd 3 ireq group interrupt interrupt priority resolving circuit group interrupt request from each peripheral function interrupt enabled ilevel (levels 0-7) data bus read-only circuit
5 5-13 ver.0.10 (2) ilevel (interrupt priority level) (d5-d7 or d13-d15) these bits set the priority levels of interrupt requests from each internal peripheral i/o. set priority level 7 to disable interrupts from some internal peripheral i/o or priority levels 0-6 to enable interrupts. when an interrupt occurs, the interrupt controller resolves priority between this interrupt and other interrupt sources based on ilevel settings and finally compares its priority with the imask value to determine whether to forward an ei request to the cpu or keep it pending. the table below shows the relationship between ilevel settings and the imask values at which interrupts are accepted. table 5.3.1 ilevel settings and accepted imask values ilevel values set imask values at which interrupts are accepted 0 (ilevel="000") accepted when imask is 1-7 1 (ilevel="001") accepted when imask is 2-7 2 (ilevel="010") accepted when imask is 3-7 3 (ilevel="011") accepted when imask is 4-7 4 (ilevel="100") accepted when imask is 5-7 5 (ilevel="101") accepted when imask is 6-7 6 (ilevel="110") accepted when imask is 7 7 (ilevel="111") not accepted (interrupts disabled) interrupt controller (icu) 5.3 icu-related registers
5 5-14 ver.0.10 5.4 icu vector table the icu vector table is used to set the start addresses of interrupt handlers for each internal peripheral i/o. the 31-source interrupts are assigned the following addresses: table 5.4.1 icu vector table addresses interrupt source icu vector table address mjt input interrupt 4 h'0000 0094-h'0000 0097 mjt input interrupt 3 h'0000 0098-h'0000 009b mjt input interrupt 2 h'0000 009c-h'0000 009f mjt input interrupt 1 h'0000 00a0-h'0000 00a3 mjt input interrupt 0 h'0000 00a4-h'0000 00a7 mjt output interrupt 7 h'0000 00a8-h'0000 00ab mjt output interrupt 6 h'0000 00ac-h'0000 00af mjt output interrupt 5 h'0000 00b0-h'0000 00b3 mjt output interrupt 4 h'0000 00b4-h'0000 00b7 mjt output interrupt 3 h'0000 00b8-h'0000 00bb mjt output interrupt 2 h'0000 00bc-h'0000 00bf mjt output interrupt 1 h'0000 00c0-h'0000 00c3 mjt output interrupt 0 h'0000 00c4-h'0000 00c7 dma0-4 interrupt h'0000 00c8-h'0000 00cb sio1 receive interruptt h'0000 00cc-h'0000 00cf sio1 transmit interruptt h'0000 00d0-h'0000 00d3 sio0 receive interruptt h'0000 00d4-h'0000 00d7 sio0 transmit interruptt h'0000 00d8-h'0000 00db a-d0 converter interruptt h'0000 00dc-h'0000 00df tid0 output interruptt h'0000 00e0-h'0000 00e3 tod0 output interruptt h'0000 00e4-h'0000 00e7 dma5-9 interruptt h'0000 00e8-h'0000 00eb sio2,3 transmit/receive interrupt t h'0000 00ec-h'0000 00ef rtd interruptt h'0000 00f0-h'0000 00f3 tid1 output interrupt h'0000 00f4-h'0000 00f7 tod1+tom0 output interrupt h'0000 00f8-h'0000 00fb sio4,5 transmit/receive interrupt h'0000 00fc-h'0000 00ff a-d1 converter interrupt h'0000 0100-h'0000 0103 tid2 output interrupt h'0000 0104-h'0000 0107 tml1 input interrupt h'0000 0108-h'0000 010b can0 transmit/receive & error interrupt h'0000 010c-h'0000 010f interrupt controller (icu) 5.4 icu vector table
5 5-15 ver.0.10 figure 5.4.1 icu vector table memory map (1/2) h'0000 0094 address d0 d7 +0 address +1 address d8 d15 h'0000 0096 mjt input interrupt 4 handler start address (a0-a15) mjt input interrupt 4 handler start address (a16-a31) h'0000 0098 h'0000 009a mjt input interrupt 3 handler start address (a0-a15) mjt input interrupt 3 handler start address (a16-a31) h'0000 009c h'0000 009e mjt input interrupt 2 handler start address (a0-a15) mjt input interrupt 2 handler start address (a16-a31) h'0000 00a0 h'0000 00a2 mjt input interrupt 1 handler start address (a0-a15) mjt input interrupt 1 handler start address (a16-a31) h'0000 00a4 h'0000 00a6 h'0000 00a8 h'0000 00aa h'0000 00ac h'0000 00ae h'0000 00b0 h'0000 00b2 h'0000 00b4 h'0000 00b6 h'0000 00b8 h'0000 00ba h'0000 00bc h'0000 00be h'0000 00c0 h'0000 00c2 h'0000 00c4 h'0000 00c6 mjt output interrupt 7 handler start address (a0-a15) mjt output interrupt 7 handler start address (a16-a31) mjt output interrupt 6 handler start address (a0-a15) mjt output interrupt 6 handler start address (a16-a31) mjt output interrupt 5 handler start address (a0-a15) mjt output interrupt 5 handler start address (a16-a31) mjt output interrupt 4 handler start address (a0-a15) mjt output interrupt 4 handler start address (a16-a31) mjt output interrupt 3 handler start address (a0-a15) mjt output interrupt 3 handler start address (a16-a31) mjt output interrupt 2 handler start address (a0-a15) mjt output interrupt 2 handler start address (a16-a31) mjt output interrupt 1 handler start address (a0-a15) mjt output interrupt 1 handler start address (a16-a31) mjt output interrupt 0 handler start address (a0-a15) mjt output interrupt 0 handler start address (a16-a31) mjt input interrupt 0 handler start address (a0-a15) mjt input interrupt 0 handler start address (a16-a31) interrupt controller (icu) 5.4 icu vector table
5 5-16 ver.0.10 figure 5.4.2 icu vector table memory map (2/2) h'0000 00c8 address d0 d7 +0 address +1 address d8 d15 h'0000 00ca dma0-4 interrupt handler start address (a0-a15) dma0-4 interrupt handler start address (a16-a31) h'0000 00cc h'0000 00ce h'0000 00d0 h'0000 00d2 h'0000 00d4 h'0000 00d6 h'0000 00d8 h'0000 00da h'0000 00dc h'0000 00de sio1 receive interrupt handler start address (a0-a15) sio1 receive interrupt handler start address (a16-a31) sio1 transmit interrupt handler start address (a0-a15) sio1 transmit interrupt handler start address (a16-a31) sio0 receive interrupt handler start address (a0-a15) sio0 receive interrupt handler start address (a16-a31) sio0 transmit interrupt handler start address (a0-a15) sio0 transmit interrupt handler start address (a16-a31) a-d0 converter interrupt handler start address (a0-a15) a-d0 converter interrupt handler start address (a16-a31) h'0000 00e0 h'0000 00e2 h'0000 00e4 h'0000 00e6 h'0000 00e8 h'0000 00ea h'0000 00ec h'0000 00ee tid0 input interrupt handler start address (a0-a15) tid0 input interrupt handler start address (a16-a31) tod0 output interrupt handler start address (a0-a15) tod0 output interrupt handler start address (a16-a31) dma5-9 interrupt handler start address (a0-a15) dma5-9 interrupt handler start address (a16-a31) sio2,3 transmit/receive interrupt handler start address (a0-a15) sio2,3 transmit/receive interrupt handler start address (a16-a31) h'0000 00f0 h'0000 00f2 rtd interrupt handler start address (a0-a15) rtd interrupt handler start address (a16-a31) h'0000 00f4 h'0000 00f6 tid1 input interrupt handler start address (a0-a15) tid1 input interrupt handler start address (a16-a31) h'0000 00f8 h'0000 00fa tod1+tom0 output interrupt handler start address (a0-a15) tod1+tom0 output interrupt handler start address (a16-a31) h'0000 00fc h'0000 00fe sio4,5 transmit/receive interrupt handler start address (a0-a15) sio4,5 transmit/receive interrupt handler start address (a16-a31) h'0000 0100 h'0000 0102 a-d1 converter interrupt handler start address (a0-a15) a-d1 converter interrupt handler start address (a16-a31) h'0000 0104 h'0000 0106 tid2 input interrupt handler start address (a00-a15) tid2 input interrupt handler start address (a16-a31) h'0000 0108 h'0000 010a tml1 input interrupt handler start address (a00-a15) tml1 input interrupt handler start address (a16-a31) h'0000 010c h'0000 010e can0 transmit/receive & error interrupt handler start address (a0-a15) can0 transmit/receive & error interrupt handler start address (a16-a31) interrupt controller (icu) 5.4 icu vector table
5 5-17 ver.0.10 5.5 description of interrupt operation 5.5.1 acceptance of internal peripheral i/o interrupts an interrupt from any internal peripheral i/o is checked to see whether or not to accept by comparing its ilevel value set by the interrupt control register and the imask value of the interrupt mask register. if its priority is higher than the imask value, the interrupt is accepted. however, when multiple interrupt requests occur simultaneously, the interrupt controller resolves priority between these interrupt requests following the procedure described below. the ilevel values set by the interrupt control register for each interrupt peripheral i/o are compared with each other. if the ilevel values are the same, they are resolved according to the predetermined hardware priority. a the ilevel value is compared with imask value. when multiple interrupt requests occur simultaneously, the interrupt controller first compares their priority levels set by each interrupt control register's ilevel bit to select an interrupt request which has the highest priority. if the interrupt requests have the same level value, they are resolved according to the hardware-fixed priority. the interrupt request thus selected has its ilevel value compared with imask value and if its priority is higher than the imask value, the interrupt controller sends an ei request to the cpu. interrupt requests may be masked by setting the interrupt mask register and the interrupt control register's ilevel bit (level 7 = disabled) provided for each internal peripheral i/o and the psw register ie bit. figure 5.5.1 example of priority resolution when accepting interrupt interrupt requested or not resolve priority according to interrupt priority levels (ilevel) resolve priority according to hardware priority compare with imask value mjt output interrupt 4 mjt output interrupt 3 mjt output interrupt 2 mjt output interrupt 1 dma0-4 interrupt a-d0 converter interrupt (ilevel settings) level 3 level 4 level 5 level 3 level 1 level 3 not requested requested requested requested requested requested hardware-fixed priority accept interrupt if psw register ie bit = 1 level 3 level 3 level 3 1 2 3 can be accepted when imask = 4-7 interrupt controller (icu) 5.5 description of interrupt operation
5 5-18 ver.0.10 table 5.5.1 hardware-fixed priority levels priority interrupt source icu vector table address type of input source high mjt input interrupt 4 (irq12) h'0000 0094-h'0000 0097 level-recognized mjt input interrupt 3 (irq11) h'0000 0098-h'0000 009b level-recognized mjt input interrupt 2 (irq10) h'0000 009c-h'0000 009f level-recognized mjt input interrupt 1 (irq9) h'0000 00a0-h'0000 00a3 level-recognized mjt input interrupt 0 (irq8) h'0000 00a4-h'0000 00a7 level-recognized mjt output interrupt 7 (irq7) h'0000 00a8-h'0000 00ab level-recognized mjt output interrupt 6 (irq6) h'0000 00ac-h'0000 00af level-recognized mjt output interrupt 5 (irq5) h'0000 00b0-h'0000 00b3 edge-recognized mjt output interrupt 4 (irq4) h'0000 00b4-h'0000 00b7 level-recognized mjt output interrupt 3 (irq3) h'0000 00b8-h'0000 00bb level-recognized mjt output interrupt 2 (irq2) h'0000 00bc-h'0000 00bf level-recognized mjt output interrupt 1 (irq1) h'0000 00c0-h'0000 00c3 level-recognized mjt output interrupt 0 (irq0) h'0000 00c4-h'0000 00c7 level-recognized dma0-4 interrupt h'0000 00c8-h'0000 00cb level-recognized sio1 receive interrupt h'0000 00cc-h'0000 00cf edge-recognized sio1 transmit interrupt h'0000 00d0-h'0000 00d3 edge-recognized sio0 receive interrupt h'0000 00d4-h'0000 00d7 edge-recognized sio0 transmit interrupt h'0000 00d8-h'0000 00db edge-recognized a-d0 converter interrupt h'0000 00dc-h'0000 00df edge-recognized tid0 output interrupt h'0000 00e0-h'0000 00e3 edge-recognized tod0 output interrupt h'0000 00e4-h'0000 00e7 level-recognized dma5-9 interrupt h'0000 00e8-h'0000 00eb level-recognized sio2,3 transmit/receive interrupt h'0000 00ec-h'0000 00ef level-recognized rtd interrupt h'0000 00f0-h'0000 00f3 edge-recognized tid1 output interrupt h'0000 00f4-h'0000 00f7 edge-recognized tod1+tom0 output interrupt h'0000 00f8-h'0000 00fb level-recognized sio4,5 transmit/receive interrupt h'0000 00fc-h'0000 00ff level-recognized a-d1 converter interrupt h'0000 0100-h'0000 0103 edge-recognized tid2 output interrupt h'0000 0104-h'0000 0107 edge-recognized tml1 input interrupt h'0000 0108-h'0000 010b level-recognized low can0 transmit/receive & error interrupt h'0000 010c-h'0000 010f level-recognized interrupt controller (icu) 5.5 description of interrupt operation
5 5-19 ver.0.10 table 5.5.2 ilevel settings and accepted imask values ilevel values set imask values at which interrupts are accepted 0 (ilevel="000") accepted when imask is 1-7 1 (ilevel="001") accepted when imask is 2-7 2 (ilevel="010") accepted when imask is 3-7 3 (ilevel="011") accepted when imask is 4-7 4 (ilevel="100") accepted when imask is 5-7 5 (ilevel="101") accepted when imask is 6-7 6 (ilevel="110") accepted when imask is 7 7 (ilevel="111") not accepted (interrupts disabled) interrupt controller (icu) 5.5 description of interrupt operation
5 5-20 ver.0.10 5.5.2 processing of internal peripheral i/o interrupts by handlers (1) branching to the interrupt handler when the cpu accepts an interrupt, control branches to the eit vector entry after hardware preprocessing as described in section 4.3, "eit processing procedure." the eit vector entry for external interrupt (ei) is located at address h'0000 0080. this address is where the instruction (not the jump address) for branching to the beginning of the interrupt processing routine for external interrupt (ei) is written. (2) processing by interrupt handler in the external interrupt (ei) handler, first save the bpc register, psw register, and general- purpose registers to the stack. next, read out the interrupt mask register (imask) and save the read value to the stack. then read out the interrupt vector register (ivect). always be sure to read out the imask before reading the ivect. a read of imask and that of ivect both triggers an operation to clear interrupt requests to the cpu and accept the next interrupt. furthermore, a read of ivect causes new_imask to be set in the imask and the accepted interrupt request to be cleared (not cleared in the case of level-recognized interrupt sources, however). the ivect register has set in it the 16 low-order bits of icu vector table address for the accepted interrupt source. read the ivect register using a signed halfword load instruction (ldh instruction) and then the content of the icu interrupt vector table indicated by the read address. make sure the icu vector table has the start addresses of interrupt handlers for each internal peripheral i/o written in it beforehand, so that control will branch to the address read from this table to execute processing by each handler. when returning from the handler, clear the psw register ie bit to 0 to disable interrupts and then restore the imask value from the stack. (3) identifying the source of interrupt generated if any internal peripheral i/o has multiple interrupt sources, check the interrupt status register for each internal peripheral i/o to identify the source of interrupt generated. (4) enabling multiple interrupts to enable another interrupt in an interrupt handler, set the psw register's ie (interrupt enable) bit to 1 to enable interrupts so that they will be accepted. however, before writing a 1 to the ie bit, always be sure to save each register (bpc, psw, general-purpose register, and imask) to the stack. interrupt controller (icu) 5.5 description of interrupt operation
5 5-21 ver.0.10 figure 5.5.2 typical operation for interrupts from internal peripheral i/o h'0000 0080 bra instruction read interrupt vector register (ivect) read icu vector table branch to interrupt handler for each internal peripheral i/o rte h'0080 0004 h'0000 0094 h'0000 010f . . . interrupt handler ei (external interrupt) handler ei (external interrupt) vector entry address program being executed interrupt generated ivect . . . . . . save bpc to stack save psw to stack save general-purpose register to stack restore bpc restore psw restore general- purpose register read interrupt mask register (imask) and save it to stack imask h'0080 0000 psw register ie bit = 1 psw register ie bit = 0 restore interrupt mask register (imask) 1 2 3 4 6 7 8 5 9 10 10 1 - 8 5 : processing of ei by interrupt handler : when enabling multiple interrupts . . . . . . icu vector table note: for operations performed when accepting eit and returning from handlers, also refer to section 4.3, "eit processing procedure." (note) (note) interrupt handler interrupt controller (icu) 5.5 description of interrupt operation
5 5-22 ver.0.10 5.6 description of system break interrupt (sbi) operation 5.6.1 acceptance of sbi system break interrupt (sbi) is an emergency interrupt which is used when power failure is detected or a fault condition is notified by an external watchdog timer. the system break interrupt is _______ accepted anytime upon detection of a falling edge on the sbi signal regardless of how the psw register ie bit is set, and cannot be masked. 5.6.2 sbi processing by handler when the system break interrupt generated has been serviced, always be sure to terminate or reset the system without returning to the program that was being executed when the interrupt occurred. figure 5.6.1 typical sbi operation h'0000 0010 bra instruction sbi (system break interrupt) handler sbi (system break interrupt) vector entry program being executed sbi generated . . . . . . processing to terminate the system note: do not return to the program that was being executed when the interrupt occurred. terminate or reset the system interrupt controller (icu) 5.6 description of system break interrupt (sbi) operation
chapter 6 chapter 6 internal memory 6.1 outline of the internal memory 6.2 internal ram 6.3 internal flash memory 6.4 registers associated with the internal flash memory 6.5 programming of the internal flash memory 6.6 boot rom 6.7 virtual flash emulation function 6.8 connecting to a serial programmer 6.9 precautions to be taken when rewriting flash memory
6 6-2 ver.0.10 6.1 outline of the internal memory the 32170 internally contains the following types of memory: ? 40 kbyte or 32 kbyte ram ? 768 kbyte, 512 kbyte, or 384 kbyte flash memory 6.2 internal ram specifications of the 32170's internal ram are shown below. table 6.2.1 specifications of the internal ram item specification capacity m32170f6 : 40 kbytes m32170f4, m32170f3 : 32kbytes location address m32170f6 : h'0080 4000 - h'0080 dfff m32170f4, m32170f3 : h'0080 4000 - h'0080 bfff wait insertion operates with no wait states (when using 40 mhz cpu clock) internal bus connection connected by 32-bit bus dual port by using the real-time debugger (rtd), data can be read (monitored) or written to any area of the internal ram via serial communication from external devices independently of the cpu. (refer to chapter 14, "real-time debugger.") 6.3 internal flash memory specifications of the 32170's internal flash memory are shown below. table 6.3.1 specifications of the internal flash memory item specification capacity m32170f6 : 768 kbytes m32170f4 : 512kbytes m32170f3 : 384kbytes location address m32170f6 : h'0000 0000 - h'000b ffff m32170f4 : h'0000 0000 - h'0007 ffff m32170f3 : h'0000 0000 - h'0005 ffff wait insertion operates with no wait states (when using 40 mhz cpu clock) durability can be rewritten 100 times internal bus connection connected by 32-bit bus other virtual flash emulation function is included. (refer to section 6.7, "virtual flash emulation function.") internal memory 6.1 outline of the internal memory
6 6-3 ver.0.10 internal memory 6.4 registers associated with the internal flash memory 6.4 registers associated with the internal flash memory the diagram below shows a register map associated with the internal flash memory. figure 6.4.1 register map associated with the internal flash memory h'0080 07e0 h'0080 07e2 address d0 d7 +0 address +1 address d8 d15 h'0080 07e4 h'0080 07e6 h'0080 07e8 h'0080 07ea h'0080 07ec h'0080 07ee h'0080 07f0 h'0080 07f2 blank addresses are reserved for future use. (note) note: the m32170f4 and m32170f3 do not have the felbank3 register. flash mode register (fmod) flash controle register 1 (fcnt1) flash controle register 3 (fcnt3) flash status register 1 (fstat1) flash controle register 2 (fcnt2) flash controle register 4 (fcnt4) virtual flash l bank register 0 (felbank0) virtual flash l bank register 1 (felbank1) virtual flash l bank register 2 (felbank2) virtual flash l bank register 3 (felbank3) virtual flash s bank register 0 (fesbank0) virtual flash s bank register 1 (fesbank1)
6 6-4 ver.0.10 d0123456d7 fpmod d bit name function r w 0 - 6 no functions assigned 0 7 fpmod 0 : fp pin = low (external fp pin status) 1 : fp pin = high the flash mode register (fmod) is a read-only status register, with its fpmod bit indicating the status of the fp (flash protect) pin. write to the flash memory is enabled only when fpmod = 1. writing to the flash memory when fpmod = 0 has no effect. 6.4.1 flash mode register n flash mode register (fmod) internal memory 6.4 registers associated with the internal flash memory
6 6-5 ver.0.10 internal memory 6.4 registers associated with the internal flash memory 6.4.2 flash status registers the 32170 has two registers to indicate the flash memory status, one of which is flash status register 1 (fstat1) located in the sfr area (address: h'0080 07e1), and the other is flash status register 2 (fstat2) included in the flash memory itself. when programming or erasing the flash memory, use these two status registers (fstat1, fstat2) to control the program/erase operations. n flash status register 1 (fstat1) d8 9 1011121314d15 fstat d bit name function r w 8 - 14 no functions assigned 0 15 fstat 0 : busy (ready/busy status) 1 : ready the flash status register 1 (fstat1) is a read-only status register used to know the execution status of whether the flash memory is being programmed or erased. when the fstat bit = 0, it means that the flash memory is being programmed or erased, during which time any operation to program the flash memory area is disabled.
6 6-6 ver.0.10 n flash status register 2 (fstat2) d8 9 1011121314d15 fbusy erase wrerr1 wrerr2 d bit name function r w 8 fbusy 0 : program or erase under way (flash busy) 1 : ready state 9 no functions assigned 0 10 erase 0 : erase normally operating/terminated (auto erase operating condition) 1 : erase error occurred 11 wrerr1 0 : program normally operating/terminated (program operating condition) 1 : program error occurred 12 wrerr2 0 : program normally operating/terminated (program operating condition) 1 : over-programming occurred 13 - 15 no functions assigned 0 the flash status register 2 (fstat2) consists of the following four read-only status bits which indicate the operating condition of the flash memory. (1) fbusy (flash busy) bit (d8) the fbusy bit is used to determine whether the operation is terminated when programming or erasing the flash memory. when fbusy = 0, it means the program or erase operation is being executed; when fbusy = 1, the operation is terminated. (2) erase (auto erase operating condition) bit (d10) the erase bit is used to determine whether execution of the flash memory erase operation has resulted in an error. when erase = 0, it means the erase operation terminated normally; when erase = 1, the operation terminated in an error. (3) wrerr1 (program operating condition) bit (d11) the wrerr1 bit is used to determine after completion of execution whether the flash memory program operation resulted in an error. when wrerr1 = 0, it means the program operation terminated normally; when wrerr1 = 1, the operation terminated in an error. the condition under which wrerr1 is set to 1 is when any bit other than those that must be 0 is found to be a 0 by comparison between the write data and the data in the flash memory. internal memory 6.4 registers associated with the internal flash memory
6 6-7 ver.0.10 internal memory 6.4 registers associated with the internal flash memory (4) wrerr2 (program operating condition) bit (d12) the wrerr2 bit is used to determine after execution whether the flash memory program operation resulted in an error. when wrerr2 = 0, it means the program operation terminated normally; when wrerr2 = 1, the operation terminated in an error. the condition under which wrerr2 is set to 1 is when the flash memory could not be written to by repeating the write operation a specified number of times. note: this status register is included in the internal flash memory itself, and can be read out by writing the read status command (h'7070) to any address of the flash memory. for details, refer to section 6.5, "programming of internal flash memory."
6 6-8 ver.0.10 d0123456d7 fentry femmod d bit name function r w 0 - 2 no functions assigned 0 3 fentry 0 : normal read (flash mode entry) 1 : erase/program enable 4 - 6 no functions assigned 0 7 femmod 0 : normal mode (virtual flash emulation mode) 1 : virtual flash emulation mode the flash control register 1 (fcnt1) consists of the following two bits to control the internal flash memory. (1) fentry (flash mode entry) bit (d3) the fentry bit controls entry to flash e/w enable mode. flash e/w enable mode can be entered only when fentry = 1. to set the fentry bit to 1, write a 0 and then a 1 to the fentry bit in succession while the fp pin = high. the fentry bit is cleared in the following cases: ? when the device is reset ? when a 0 is written to the fentry bit ? when the fp pin changes state from high to low 6.4.3 flash controle registers n flash controle register 1 (fcnt1) internal memory 6.4 registers associated with the internal flash memory
6 6-9 ver.0.10 when using a program in the flash memory while the fentry bit = 0, the ei vector entry is located at address h'0000 0080 of the flash memory. when running a flash rewrite program in ram while the fentry bit = 1, the ei vector entry is located at address h'0080 4000 of the ram, allowing for flash rewrite operation to be controlled using interrupts. table 6.4.1 changes of ei vector entry by fentry fentry ei vector entry address 0 flash memory area h'0000 0080 1 internal ram area h'0080 4000 (2) femmod (virtual flash emulation mode) bit (d7) the femmod bit controls entry to virtual flash emulation mode. virtual flash emulation mode is entered by setting the femmod bit to 1 while the fentry bit = 0. (for details, refer to section 6.7, "virtual flash emulation function.") internal memory 6.4 registers associated with the internal flash memory
6 6-10 ver.0.10 internal memory 6.4 registers associated with the internal flash memory n flash controle register 2 (fcnt2) d8 9 1011121314d15 fprot d bit name function r w 8 - 14 no functions assigned 0 15 fprot 0 : protection by lock bit effective (unlock) 1 : protection by lock bit not effective the flash control register 2 (fcnt2) controls invalidation of the internal flash memory protection by a lock bit (to disable erasing or programming of the flash memory). the flash memory protection becomes invalid (unlocked) by setting the fprot bit to 1, so that any blocks protected by the lock bit can be erased or programmed. to set the fprot bit to 1, write a 0 and then a 1 to the fprot bit in succession while the fentry bit = 1. the fprot bit is cleared to 0 by writing a 0 to the fprot bit and setting the fp pin low or the fentry bit to 0 immediately after reset. figure 6.4.2 protection unlocking flow fprot=0 yes no fentry=1 fprot=1 fprot is not set to 1 if write cycle to any other area occurs during this time fprot=0 fprot=1 fentry=1
6 6-11 ver.0.10 internal memory 6.4 registers associated with the internal flash memory n flash controle register 3 (fcnt3) d0123456d7 felevel d bit name function r w 0 - 6 no functions assigned 0 7 felevel 0 : normal level (raise erase margin) 1 : raise erase margin the flash control register 3 (fcnt3) controls the depth of erase levels when erasing the internal flash memory with one of erase commands. by setting the felevel bit to 1, the flash memory erase level can be deepened, which will result in an increased reliability margin.
6 6-12 ver.0.10 internal memory 6.4 registers associated with the internal flash memory n flash controle register 4 (fcnt4) d8 9 1011121314d15 freset d bit name function r w 8 - 14 no functions assigned 0 15 freset 0 : no operation performed (reset flash) 1 : reset the flash memory the flash control register 4 (fcnt4) controls canceling program/erase operation in the middle and initializing each status bit of flash status register 2 (fstat2). when the freset bit is set to 1, program/erase operation is canceled in the middle and each status bit of fstat2 is initialized (h'80). the freset bit is effective only when the fentry bit = 1. information on freset bit is ignored unless the fentry bit = 1. make sure that when programming or erasing the flash memory, the freset bit remains 0.
6 6-13 ver.0.10 figure 6.4.3 example for using the fcnt4 register internal memory 6.4 registers associated with the internal flash memory freset=1 yes no fentry=1 program/erase flash memory error found program/erase terminated normally freset=0 program/erase flash memory fentry=0
6 6-14 ver.0.10 6.4.4 virtual flash l bank registers n virtual flash l bank register 0 (felbank0) n virtual flash l bank register 1 (felbank1) n virtual flash l bank register 2 (felbank2) n virtual flash l bank register 3 (felbank3) internal memory 6.4 registers associated with the internal flash memory lbankad d01234567891011121314d15 d bit name function r w 0 modenl 0 : disable virtual flash function (virtual flash emulation enable) 1 : enable virtual flash function 1 - 7 no functions assigned 0 8 - 14 lbankad a12 - a18 of start address of the l bank (l bank address) to be selected 15 no functions assigned 0 note: this register must always be accessed in halfword. (1) modenl (virtual flash emulation enable) bit (d0) the modenl bit can be set to 1 after entering virtual flash emulation mode (by setting the femmod bit to 1 while the fentry bit = 0). this causes the virtual flash emulation function to become effective for the l bank area selected by the lbankad bits. (2) lbankad (l bank address) bits (d8-d14) the lbankad bits are provided for selecting one l bank from a total of 96 l banks separated every 8 kb. use these lbankad bits to set the seven bits, a12-a18, of the 32-bit start address of the l bank you want to select. (for details, refer to section 6.7, "virtual flash emulation function.") note: the m32170f4 and m32170f3 do not have virtual flash l bank register 3 (felbank3). mod enl
6 6-15 ver.0.10 6.4.5 virtual flash s bank registers n virtual flash s bank register 0 (fesbank0) n virtual flash s bank register 1 (fesbank1) internal memory 6.4 registers associated with the internal flash memory sbankad d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 d bit name function r w 0 modens 0 : disable virtual flash function (virtual flash emulation enable) 1 : enable virtual flash function 1 - 7 no functions assigned 0 8 - 15 sbankad a12 - a19 of start address of the s bank (s bank address) to be selected note: this register must always be accessed in halfword. (1) modens (virtual flash emulation enable) bit (d0) the modens bit can be set to 1 after entering virtual flash emulation mode (by setting the femmod bit to 1 while the fentry bit = 0). this causes the virtual flash emulation function to become effective for the s bank area selected by the sbankad bits. (2) sbankad (s bank address) bits (d8-d15) the sbankad bits are provided for selecting one s bank from a total of 192 s banks separated every 4 kb. use these sbankad bits to set the eight bits, a12-a19, of the 32-bit start address of the s bank you want to select. (for details, refer to section 6.7, "virtual flash emulation function.") mod ens
6 6-16 ver.0.10 6.5 programming of the internal flash memory 6.5.1 outline of programming flash memory when writing to the internal flash memory, there are following two methods to use depending on situation: (1) when the write program does not exist in the internal flash memory (2) when the write program already exists in the internal flash memory for (1), set the fp pin = high, mod0 = high, and mod1 = low to enter boot flash e/w enable mode. in this case, the reset vector entry is located at the beginning of the boot program area (h'8000 0000). (normally, the reset vector entry is located at the start address of the internal flash memory.) transfer the "flash write program" from the boot area into the internal ram using a boot program. after this transfer, jump to the ram and set the flash control register 1 fentry bit to 1 to make the flash memory ready for write. you now can write to the internal flash memory using the "flash write program" that has been transferred into the internal ram. for (2), set the fp pin = high, mod0 = low, and mod1 = low to enter flash e/w enable mode in single-chip mode. transfer the "flash write program" from the internal flash memory in which it has been prepared beforehand into the internal ram. after this transfer, jump to the ram and set the flash control register 1 (fcnt1) fentry bit to 1 using a program in the ram to make the flash memory ready for write. you now can write to the internal flash memory using the "flash write program" that has been transferred into the internal ram. or you can set the fp pin = high, mod0 = low, and mod1 = high to enter flash e/w enable mode in extended external mode. when in flash e/w enable mode (fp pin = 1, fentry bit = 1), the eit vector entry for external interrupt (ei) is moved to the beginning of the internal ram (h'0080 4000). during normal mode, the eit vector entry exists in the flash area (h'0000 0080). internal memory 6.5 programming of the internal flash memory
6 6-17 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.1 ei vector entry when in flash e/w enable mode ei vector entry internal rom area internal ram (h'0000 0080) h'0000 0000 h'00ff ffff h'0080 4000 internal rom area internal ram h'0080 3fff flash e/w enable mode (fentry=1) normal mode (fentry=0) h'0000 0000 h'0080 3fff ei vector entry (h'0080 4000) h'0080 4000 h'00ff ffff
6 6-18 ver.0.10 (1) when the write program does not exist in the internal flash memory use a program in the boot rom located on memory map to write to the flash memory. to transfer the write data, use serial i/o1 in clock-synchronized serial mode. use this serial transfer when writing to the flash memory using a flash programmer. internal memory 6.5 programming of the internal flash memory figure 6.5.2 procedure for writing to internal flash memory (when the write program does not exist in the flash memory) sio1 aaa aaa cpu aaa aaa sio1 aaa aaa cpu aaa a a a aaa flash write program aaaa aaaa mod1= l aaa aaa sio1 aaa a a a aaa cpu aaa a a a aaa aaa a a a aaa ram flash memory fp=l or h aaaa aaaa ram ram initial state (where the write program does not (exist in the flash memory) set the fp pin high, the mod0 pin high, and the mod1 pin low to place the device in boot mode + flash e/w enable mode. deassert reset and start up using the boot program. transfer the flash write program from boot rom to ram. jump to the flash write program in ram. using the flash write program in ram, set the flash control register 1 (fcnt1) fentry bit to 1. write data to the internal flash memory using the flash write program. when you finished writing, reset mod0 low and jump to the flash memory or apply reset to enter normal mode. m32r/e m32r/e m32r/e external device external device flash memory flash write data flash memory mod0=l boot rom boot rom boot rom mod1= l fp=h mod0=h mod1= l fp=h mod0=h reset=l reset=h reset=h flash write program write data write data external device write data
6 6-19 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.3 internal flash memory write timings (when the write program does not exist in the flash memory) reset mod0 fentry fp mod1 power on mode selected reset deasserted (boot program starts) mode selected reset deasserted writes to flash memory by boot program settings by boot program
6 6-20 ver.0.10 (2) when the write program already exists in the internal flash memory use the flash write program already stored in the internal flash memory to write to the flash memory. for write to the flash memory, use the internal peripheral circuits according to your programming system. (the data bus, serial i/o, and ports can be used.) the following shows an example for writing to the flash memory by using serial i/o0 in single-chip mode. internal memory 6.5 programming of the internal flash memory figure 6.5.4 procedure for writing to internal flash memory (when the write program already exists in the flash memory) sio0 aaa aaa cpu aaa aaa sio0 aaa aaa cpu aaa a a a aaa flash write program aaaa aaaa mod1= l aaa aaa sio0 aaa a a a aaa cpu aaa aaa aaa a a a aaa ram flash write program fp=l or h aaaa aaaa ram ram initial state (where the write program already exists in the flash memory) ordinary program in the flash memory is being executed. set the fp pin high, the mod1 pin low, and the mod0 pin low to place the device in single-chip + flash e/w enable mode. after determining the fp pin and mod1 pin levels, transfer the flash write program from the flash memory area into ram. jump to the flash write program in ram. using the flash write program in ram, set the flash control register 1 (fcnt1) fentry bit to 1. write data to the internal flash memory using the flash write program in ram. when you finished writing, jump to the program in the flash memory or apply reset to enter normal mode. m32r/e m32r/e m32r/e external device external device flash memory flash write data flash memory boot rom boot rom boot rom mod1= l fp=h mod1= l fp=h mod0=l mod0=l mod0=l flash write program write data write data external device write data
6 6-21 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.5 internal flash memory write timings (when the write program already exists in the flash memory) reset mod0 fentry fp "h" or "l" "h" or "l" (single-chip or extended external) mod1 "l" "h" or "l" write to flash memory by flash rewrite program flash rewrite starts flash mode turned off flash rewrite program transferred to ram flash mode turned on
6 6-22 ver.0.10 6.5.2 controlling operation mode during programming flash the device's operation modes are set by mod0, mod1, and flash control register 1 (fcnt1) fentry bit. the table below lists operation modes that may be set during flash write. table 6.5.1 operation modes set during flash write fp mod0 mod1 fentry (note) operation mode reset vector entry ei vector entry 0 0 0 single-chip mode start address of flash area 1000 flash memory (h'0000 0080) (h'0000 0000) 0 1 0 processor mode start address of external area external area (h'0000 0080) (h'0000 0000) 001 extended external mode start address of flash area 1010 flash memory (h'0000 0080) (h'0000 0000) 1001 single-chip mode start address of beginning of + flash e/w enable flash memory internal ram (h'0000 0000) (h'0080 4000) 1100 boot mode start address of flash area boot program area (h'0000 0080) (h'8000 0000) 1101 boot mode start address of beginning of + flash e/w enable boot program area internal ram (h'8000 0000) (h'0080 4000) 1011 extended external mode start address of beginning of + flash e/w enable flash memory internal ram (h'0000 0000) (h'0080 4000) 1 1 reserved note: indicates the fentry bit status of flash control register 1 (fcnt1). the bar "" denotes "don't care." (1) flash e/w enable mode flash e/w enable mode is a mode in which the internal flash memory can be programmed or erased. in flash e/w enable mode, no programs can be executed in the internal flash memory. therefore, before entering flash e/w enable mode, you need to transfer the necessary program into the internal ram and run the program in ram. internal memory 6.5 programming of the internal flash memory
6 6-23 ver.0.10 internal memory 6.5 programming of the internal flash memory (2) entering flash e/w enable mode flash e/w enable mode can be entered only when the device is operating in single-chip mode or extended external mode. namely, you can enter flash e/w enable mode only when the fp pin = high and the flash control register 1 (fcnt1) fentry bit = 1. you cannot enter flash e/w enable mode when the device is operating in processor mode or the fp pin = low. (3) detecting the mod0 and mod1 pin levels the mod0 and mod1 pin levels (high or low) can be verified using the p8 data register (port data register, h'00800 0708) mod0dt and mod1dt bits. n p8 data register (p8data) d0123456d7 mod0dt mod1dt p82dt p83dt p84dt p85dt p86dt p87dt d bit name function r w 0 mod0dt 0 : mod0 pin = low (mod0 data) 1 : mod0 pin = high 1 mod1dt 0 : mod1 pin = low (mod1 data) 1 : mod1 pin = high 2 p82dt depending on how the port direction register is set (port p82 data) ? when direction bit = 0 (input mode) 3 p83dt 0: port input pin = low (port p83 data) 1: port input pin = high 4 p84dt ? when direction bit = 1 (output mode) (port p84 data) 0: port output latch = low 5 p85dt 1: port output latch = high (port p85 data) 6 p86dt (port p86 data) 7 p87dt (port p87 data)
6 6-24 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.6 procedure for entering flash e/w enable mode note: for details about each command, refer to section 6.5.3, "programming procedure to internal flash memory." end start enter one of the following modes: ?single-chip mode + flash e/w enable mode ?boot mode + flash e/w enable mode ?extended external mode + flash e/w enable mode transfer e/w program to internal ram in each mode set flash control register in sfr area (fcnt1, h'0080 07e2) flash entry (fentry) bit to 0 set flash control register in sfr area (fcnt1, h'0080 07e2) flash entry (fentry) bit to 1 execute flash e/w command and various read commands (note) switched to flash e/w program 1 ? wait (by hardware timer or software timer) jump to flash memory or apply reset switched to normal mode mod0, 1 fp pin levels checked ok no end fmod(h'0080 07e0) fpmod p8data(h'0080 0708) d0=mod0dt d1=mod1dt
6 6-25 ver.0.10 internal memory 6.5 programming of the internal flash memory 6.5.3 programming procedure to the internal flash memory to write to the internal flash memory, set the device's operation mode to enter flash e/w enable mode first and then use the flash write program that has already been transferred from the flash memory into the internal ram. in flash e/w enable mode, no data can be read out from the internal flash memory as in normal mode, so you cannot execute a program that exists in the internal flash memory. therefore, the flash write program must be prepared in the internal ram before entering flash e/w enable mode. (once you've entered flash e/w enable mode, you cannot use any command except flash commands to access the flash memory.) to access the internal flash memory in flash memory e/w enable mode, issue commands for the internal flash memory address to be operated on. the table below lists the commands that can be issued in flash memory e/w enable mode. note : during flash e/w enable mode, the flash memory cannot be accessed for read or write wordwise. table 6.5.2 commands in flash memory e/w enable mode command name issued command data read array command h'ffff page program command h'4141 lock bit program command h'7777 block erase command h'2020 erase all unlock block command h'a7a7 read status register command h'7070 clear status register command h'5050 read lock bit status command h'7171 verify command (note) h'd0d0 note: this command is used in conjunction with lock bit program, block erase, and erase all unlock block operations. (1) read array command read mode is entered by writing command data h'ffff to any address of the internal flash memory. then read the flash memory address you want to read out, and the content of that address will be read out. before exiting flash e/w enable mode, always be sure to execute the read array command.
6 6-26 ver.0.10 internal memory 6.5 programming of the internal flash memory (2) page program command flash memory is programmed one page at a time, each page consisting of 256 bytes (lower addresses h'00 to h'ff). to write data to the flash memory (i.e., to program the flash memory), write the program command h'4141 to any address of the internal flash memory and then the program data to the address to which you want to write. with the page program command, you cannot write to the protected blocks. page program is automatically performed by the internal control circuit, and the completion of programming can be verified by checking the flash status register 1 (fstat1) fstat bit. (refer to section 6.4.2, "flash status registers.") while the fstat bit = 1, the next programming can not be performed. (3) lock bit program command flash memory can be protected against program/erase one block at a time. the lock bit program command is provided for protecting memory blocks. write the lock bit program command data h'7777 to any address of the internal flash memory. next, write the verify command data h'd0d0 to the last even address of the block you want to protect, and this memory block is protected against program/erase. to remove protection, disable lock bit-effectuated protection using the flash control register 2 (fcnt2) fprot bit (see section 6.4.3, "flash control registers") and erase the block whose protection you want to remove. (the content of this memory block is also erased.) the table below lists the target blocks and their specified addresses when writing the verify command data.
6 6-27 ver.0.10 internal memory 6.5 programming of the internal flash memory table 6.5.3 m32170f6 target blocks and specified addresses target block specified address 0 h'0000 3ffe 1 h'0000 5ffe 2 h'0000 7ffe 3 h'0000 fffe 4 h'0001 fffe 5 h'0002 fffe 6 h'0003 fffe 7 h'0004 fffe 8 h'0005 fffe 9 h'0006 fffe 10 h'0007 fffe 11 h'0008 fffe 12 h'0009 fffe 13 h'000a fffe 14 h'000b fffe table 6.5.4 m32170f4 target blocks and specified addresses target block specified address 0 h'0000 3ffe 1 h'0000 5ffe 2 h'0000 7ffe 3 h'0000 fffe 4 h'0001 fffe 5 h'0002 fffe 6 h'0003 fffe 7 h'0004 fffe 8 h'0005 fffe 9 h'0006 fffe 10 h'0007 fffe
6 6-28 ver.0.10 internal memory 6.5 programming of the internal flash memory table 6.5.5 m32170f3 target blocks and specified addresses target block specified address 0 h'0000 3ffe 1 h'0000 5ffe 2 h'0000 7ffe 3 h'0000 fffe 4 h'0001 fffe 5 h'0002 fffe 6 h'0003 fffe 7 h'0004 fffe 8 h'0005 fffe
6 6-29 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.7 block configuration of the m32170f6 flash memory m32170f6's internal flash memory area (768kb) h'0002 0000 8kb 16kb 8kb 32kb 64kb h'0000 0000 h'0000 7fff h'0000 8000 h'0001 ffff h'0000 3fff h'0000 4000 h'0000 ffff h'0001 0000 h'0000 5fff h'0000 6000 64kb h'0002 ffff 64kb h'0009 ffff h'0009 0000 64kb h'000a ffff h'000a 0000 64kb h'000b ffff h'000b 0000 64kb block 0 64kb 64kb 64kb 64kb 64kb h'0003 0000 h'0003 ffff h'0004 0000 h'0004 ffff h'0005 0000 h'0005 ffff h'0006 0000 h'0006 ffff h'0007 0000 h'0007 ffff h'0008 0000 h'0008 ffff block 1 block 2 block 3 block 4 block 5 block 6 block 7 block 8 uneven blocks even blocks block 9 block 10 block 11 block 12 block 13 block 14
6 6-30 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.8 block configuration of the m32170f4 flash memory m32170f4's internal flash memory area (512kb) h'0002 0000 8kb 16kb 8kb 32kb 64kb h'0000 0000 h'0000 7fff h'0000 8000 h'0001 ffff h'0000 3fff h'0000 4000 h'0000 ffff h'0001 0000 h'0000 5fff h'0000 6000 64kb h'0002 ffff 64kb 64kb 64kb block 0 64kb 64kb h'0003 0000 h'0003 ffff h'0004 0000 h'0004 ffff h'0005 0000 h'0005 ffff h'0006 0000 h'0006 ffff h'0007 0000 h'0007 ffff block 1 block 2 block 3 block 4 block 5 block 6 block 7 block 8 uneven blocks even blocks block 9 block 10
6 6-31 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.9 block configuration of the m32170f3 flash memory m32170f3's internal flash memory area (384kb) h'0002 0000 8kb 16kb 8kb 32kb 64kb h'0000 0000 h'0000 7fff h'0000 8000 h'0001 ffff h'0000 3fff h'0000 4000 h'0000 ffff h'0001 0000 h'0000 5fff h'0000 6000 64kb h'0002 ffff 64kb 64kb 64kb block 0 h'0003 0000 h'0003 ffff h'0004 0000 h'0004 ffff h'0005 0000 h'0005 ffff block 1 block 2 block 3 block 4 block 5 block 6 block 7 block 8 uneven blocks even blocks
6 6-32 ver.0.10 internal memory 6.5 programming of the internal flash memory (4) block erase command the block erase command erases the contents of internal flash memory one block at a time. for block erase, write the command data h'2020 to any address of the internal flash memory. next, write the verify command data h'd0d0 to the last even address of the memory block you want to erase (see table 6.5.3, table 6.5.4, and table 6.5.5, "target blocks and specified addresses"). the content of this memory block is erased. with the block erase command, you cannot erase the protected blocks. block erase is automatically performed by the internal control circuit, and the completion of block erase can be verified by checking the flash status register 1 (fstat1) fstat bit. (refer to section 6.4.2, "flash status registers.") while the fstat bit = 1, you cannot erase the next block. (5) erase all unlock block command the erase all unlock block command erases all memory blocks that are not protected. to erase all unlock blocks, write the command data h'a7a7 to any address of the internal flash memory. next, write the command data h'd0d0 to any address of the internal flash memory, and all of unprotected memory blocks are erased. (6) read status register command the read status register command reads out the content of flash status register 2 (fstat2) that indicates whether flash memory write or erase operation has terminated normally or not. to read flash status register 2, write the command data h'7070 to any address of the internal flash memory. next, read any address of the internal flash memory, and the content of flash status register 2 (fstat2) is read out. (7) clear status register command the clear status register command clears the flash status register 2 (fstat2) d10, d11, and d12 bits to 0. write the command data h'5050 to any address of the internal flash memory, and flash status register 2 is cleared to 0. if an error occurs when programming or erasing the flash memory and the flash status register 2 (fstat2) erase (auto erase operating condition) or wrerr2 (program operating condition 2) bit is set to 1, you cannot perform the next program or erase operation unless wrerr1 (program operating condition 1) or wrerr2 (program operating condition 2) is cleared to 0.
6 6-33 ver.0.10 internal memory 6.5 programming of the internal flash memory flbst0 flbst1 d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 d bit name function r w 0 no functions assigned ? 1 flbst0 0 : protected (lock bit 0) 1 : not protected 2 - 8 no functions assigned ? 9 flbst1 0 : protected (lock bit 1) 1 : not protected (same content as flbst0 is output.) 10 - 15 no functions assigned ? the lock bit status register is a read-only register, which contains said lock bits independently for each block. (8) read lock bit status command the read lock bit status command allows you to check whether or not a memory block is protected against program/erase. write the command data h'7171 to any address of the internal flash memory. next, read the last even address of the block you want to check (see table 6.5.3, table 6.5.4, and table 6.5.5, "target blocks and specified addresses"), and the data you read shows whether or not the target block is protected. if the flbst0 (lock bit 0) bit and flbst1 (lock bit 1) bit of the data you read are 0s, it means that the target memory block is protected. if the flbst0 (lock bit 0) bit and flbst1 (lock bit 1) bit are 1s, it means that the target memory block is not protected. n lock bit status register (flbst)
6 6-34 ver.0.10 internal memory 6.5 programming of the internal flash memory follow the procedure described below to write to the lock bits. a) setting the lock bit to 0 (protect the block) issue the lock bit program command (h'7777) to the memory block you want to protect. b) setting the lock bit to 1 (unprotect the block) after setting the flash control register 2 fprot bit to invalidate lock bit-effectuated protection, use the block erase command (h'2020) or erase all unprotect block command (h'a7a7) to erase the memory block you want to unprotect. this is the only way to unprotect a memory block. you cannot set the lock bit alone to 1. c) status when the lock bit is reset the lock bit is unaffected by a reset or power outage because it is a nonvolatile bit. (9) execution flow of each command the diagrams below show an execution flow of each command. figure 6.5.10 read array start write read array command (h'ffff) to any address of internal flash memory read the internal flash memory address you want to read end
6 6-35 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.11 page program note 1: start writing from the beginning of a 256-byte boundary of the flash memory (lower address h'00). note 2: when program operation starts, you have the read status register command automatically entered. (you do not need to enter the read status register command until you issue another command.) note 3: examine the flash status register 2 erese (auto erase operating condition), wrerr1 (program operating condition 1), and wrerr2 (program operating condition 2) bits to check for program error. end write data to the internal flash memory address to which you want to write. (note 1) increment the previous write address by 2 and write the next data to the new address. write page program command (h'4141) to any address of internal flash memory. written to the internal flash memory by page program (note 2) programmed for one page ? no yes 1 s wait (by hardware timer or software timer) fstat bit = 1 yes no go to next page start read any address of internal flash memory to check for program error. (note 3) last address ? yes no time out ? 0.5s yes no forcibly terminated
6 6-36 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.12 lock bit program note 1: when program operation starts, you have the read status register command automatically entered. (you do not need to enter the read status register command until you issue another command.) note 2: examine the flash status register 2 erese (auto erase operating condition), wrerr1 (program operating condition 1), and wrerr2 (program operating condition 2) bits to check for program error. end write verify command (h'd0d0) to the last even address of the block you want to protect. written to the lock bit by program (note 1) write lock bit program command (h'7777) to any address of internal flash memory. 1 s wait (by hardware timer or software timer) fstat bit = 1 yes no start read any address of internal flash memory to check for program error. (note 2) time out ? 0.5s yes no forcibly terminated
6 6-37 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.13 block erase note 1: when erase operation starts, you have the read status register command automatically entered. (you do not need to enter the read status register command until you issue another command.) note 2: examine the flash status register 2 erese (auto erase operating condition), wrerr1 (program operating condition 1), and wrerr2 (program operating condition 2) bits to check for erase error. end write verify command (h'd0d0) to the last even address of the block you want to erase. flash memory contents erased by erase program (note 1) write erase command (h'2020) to any address of internal flash memory. 1 s wait (by hardware timer or software timer) fstat bit = 1 yes no start read any address of internal flash memory to check for erase error. (note 2) time out ? 1s yes no forcibly terminated
6 6-38 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.14 erase all unlock block note 1: when erase operation starts, you have the read status register command automatically entered. (you do not need to enter the read status register command until you issue another command.) note 2: examine the flash status register 2 erese (auto erase operating condition), wrerr1 (program operating condition 1), and wrerr2 (program operating condition 2) bits to check for erase error. end write verify command (h'd0d0) to any address in memory blocks you want to erase. flash memory contents erased by erase program (note 1) write erase all unlock block command (h'a7a7) to any address of internal flash memory. 1 s wait (by hardware timer or software timer) fstat bit = 1 yes no start read any address of internal flash memory to check for erase error. (note 2) time out ? 10s yes no forcibly terminated
6 6-39 ver.0.10 internal memory 6.5 programming of the internal flash memory figure 6.5.15 read status register figure 6.5.17 read lock bit status register figure 6.5.16 clear status register write read status command (h'7070) to any address of internal flash memory. start read any address of internal flash memory. end write clear status command (h'5050) to any address of internal flash memory. start end write read lock bit status command (h'7171) to any address of internal flash memory. start read the last even address of the block whose status you want to read. end
6 6-40 ver.0.10 internal memory 6.5 programming of the internal flash memory 6.5.4 flash write time (for reference) the time required for writing to the internal flash memory is shown below for your reference. (1) m32170f6 transfer time by sio (for a transfer data size of 768 kb) 1/57600 bps 1 (frame) 11 (number of transfer bits) 768 kb 150.2 [s] flash write time 768 kb/256-byte block 8 ms 24.6 [s] a erase time (entire area) 50 ms number of blocks = 750 [ms] ? total flash write time (entire 768 kb area) when communicating at 57600 bps using uart, the flash write time can be ignored because it is very short compared to the serial communication time. therefore, the flash write time can be calculated using the equation below: + a 151 [s] when writing data to flash memory at high speed by speeding up the serial communication or by other means, the fastest write time possible is as follows: + a 25 [s] (2) m32170f4 transfer time by sio (for a transfer data size of 512 kb) 1/57600 bps 1 (frame) 11 (number of transfer bits) 512 kb 100.2 [s] flash write time 512 kb/256-byte block 8 ms 16.4 [s] a erase time (entire area) 50 ms number of blocks = 550 [ms] ? total flash write time (entire 512 kb area) when communicating at 57600 bps using uart, the flash write time can be ignored because it is very short compared to the serial communication time. therefore, the flash write time can be calculated using the equation below: + a 101 [s] when writing data to flash memory at high speed by speeding up the serial communication or by other means, the fastest write time possible is as follows: + a 17 [s] . = . . = . . = . . = . . = . . = . . = . . = .
6 6-41 ver.0.10 internal memory 6.5 programming of the internal flash memory (3) m32170f3 transfer time by sio (for a transfer data size of 384 kb) 1/57600 bps 1 (frame) 11 (number of transfer bits) 384 kb 75.1 [s] flash write time 384 kb/256-byte block 8 ms 12.3 [s] a erase time (entire area) 50 ms number of blocks = 450 [ms] ? total flash write time (entire 384 kb area) when communicating at 57600 bps using uart, the flash write time can be ignored because it is very short compared to the serial communication time. therefore, the flash write time can be calculated using the equation below: + a 76 [s] when writing data to flash memory at high speed by speeding up the serial communication or by other means, the fastest write time possible is as follows: + a 13 [s] . = . . = . . = . . = .
6 6-42 ver.0.10 internal memory 6.6 boot rom 6.6 boot rom the table below shows boot memory specifications of the 32170. table 6.6.1 boot memory specifications item specification capacity 8 kbytes location address h'8000 0000 - h'8000 1fff wait insertion operates with no wait states (with 40 mhz internal cpu memory clock) internal bus connection connected by 32-bit bus read can only be read when fp = 1, mod0 = 1, and mod1 = 0. when read in other modes, indeterminate values are read out. cannot be accessed for write. other because the boot rom area is a reserved area that can only be used in boot mode, the program cannot be modified.
6 6-43 ver.0.10 internal memory 6.7 virtual flash emulation function 6.7 virtual flash emulation function the 32170 has a special function, called the "virtual flash emulation function," which allows the internal ram to be mapped in blocks of 8 kbytes from the beginning (up to four blocks for the m32170f6, up to three blocks for the m32170f4 and m32170f3) into the internal flash memory area divided in units of 8 kbytes (l banks). similarly, this function allows the internal ram to be mapped in blocks of 4 kbytes, for the m32170f6 (up to two blocks) starting from the ram address h'0080 c000, for the m32170f4 and m32170f3 (up to two blocks) starting from the ram address h'0080 a000 into the internal flash memory area divided in units of 4 kbytes (s banks). when this function is used, the data placed in 8 kbyte or 4 kbyte blocks of internal ram can be moved to or from the l or s banks in the flash memory that are specified by the virtual flash bank register. for applications that require modifying data during program operation, this enables dynamic modification of data using 8 kbytes or 4 kbytes of ram areas. the ram blocks allocated for virtual flash emulation can be read or written to from both internal ram and internal flash memory areas. this function, when used in combination with the real-time debugger (rtd), permits you to look up or rewrite from outside the data tables created in the internal flash memory, thus facilitating data table tuning from an external device. before accessing the internal flash memory for programming, be sure to terminate this virtual flash emulation mode. figure 6.7.1 internal ram bank configuration of the m32170f6 ram bank l block 0 (felbank0) 8 kbytes h'0080 4000 h'0080 6000 h'0080 8000 h'0080 a000 h'0080 c000 h'0080 d000 ram bank l block 1 (felbank1) 8 kbytes ram bank l block 2 (felbank2) 8 kbytes ram bank l block 3 (felbank3) 8 kbytes ram bank s block 0 (fesbank0) 4 kbytes ram bank s block 1 (fesbank1) 4 kbytes
6 6-44 ver.0.10 internal memory 6.7 virtual flash emulation function figure 6.7.2 internal ram bank configuration of the m32170f4 and m3170f3 h'0080 4000 h'0080 6000 h'0080 8000 h'0080 a000 h'0080 b000 ram bank l block 0 (felbank0) 8 kbytes ram bank l block 1 (felbank1) 8 kbytes ram bank l block 2 (felbank2) 8 kbytes ram bank s block 0 (fesbank0) 4 kbytes ram bank s block 1 (fesbank1) 4 kbytes
6 6-45 ver.0.10 6.7.1 virtual flash emulation area the following shows the areas for which the virtual flash emulation function is effective. the virtual flash l bank registers (felbank0 to felbank3 for the m32170f6, felbank0 to felbank2 for the m32170f4 and m32170f3) allow one among all l banks of flash memory divided in 8 kbytes each to be selected by setting the seven bits a12-a18 of the start address of the desired l bank in the virtual flash l bank register lbankad bits. then, by setting the virtual flash l bank register modenl0-3 bits (for the m32170f6) or modenl0-2 bits (for the m32170f4 and m32170f3) to 1, the selected l bank area can be replaced with 8 kbyte blocks of internal ram from the beginning of the internal ram (up to four blocks for the m32170f6, or up to three blocks for the m32170f4 and m32170f3). similarly, the virtual flash s bank registers (fesbank0, fesbank1) allow one among all s banks of flash memory divided in 4 kbytes each to be selected by setting the eight bits a12-a19 of the start address of the desired s bank in the virtual flash s bank register sbankad bits. then, by setting the virtual flash s bank register modens0-1 bits to 1, the selected s bank area can be replaced with 4 kbyte blocks of internal ram in up to two blocks starting from h'0080 c000 for the m32170f6 or h'0080 a000 for the m32170f4 and m32170f3. for the m32170f6, you can choose four 8-kbyte l banks and two 4-kbyte s banks, for a total of six banks (maximum). for the m32170f4 and m32170f3, you can choose three 8-kbyte l banks and two 4-kbyte s banks, for a total of five banks (maximum). note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area (8 kbyte or 4 kbyte) selected according to the priority of virtual flash bank registers shown below is assigned. ? m32170f6 felbank0 > felbank1 > felbank2 > felbank3 > fesbank0 > fesbank1 ? m32170f4 and m32170f3 felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 note 2: during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. internal memory 6.7 virtual flash emulation function
6 6-46 ver.0.10 internal memory 6.7 virtual flash emulation function figure 6.7.3 the m32170f6's virtual flash emulation area divided in units of 8 kbytes figure 6.7.4 the m32170f6's virtual flash emulation area divided in units of 4 kbytes note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > felbank3 > fesbank0 > fesbank1 is assigned. note 2: when you access an 8-kbyte area (l bank) specified by virtual flash l bank registers 0-3, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > felbank3 > fesbank0 > fesbank1 is assigned. note 2: when you access an 4-kbyte area (s bank) specified by virtual flash s bank registers 0,1, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. h'0000 0000 h'0000 2000 h'0006 6000 h'0080 4000 h'0080 6000 l bank 0 (8 kbytes) h'0000 4000 h'0006 4000 8 kbytes h'000b e000 h'000b c000 h'0080 8000 h'0080 a000 l bank 1 (8 kbytes) l bank 2 (8 kbytes) l bank 50 (8 kbytes) l bank 51 (8 kbytes) l bank 94 (8 kbytes) l bank 95 (8 kbytes) 8 kbytes 8 kbytes 8 kbytes 4 kbytes 4 kbytes h'0000 0000 h'0000 1000 h'0080 4000 h'0000 2000 h'000b f000 h'000b e000 h'0080 c000 h'0080 d000 s bank 0 (4 kbytes) s bank 1 (4 kbytes) s bank 2 (4 kbytes) s bank 190 (4 kbytes) s bank 191 (4 kbytes) 8 kbytes 8 kbytes 8 kbytes 4 kbytes 4 kbytes 8 kbytes
6 6-47 ver.0.10 internal memory 6.7 virtual flash emulation function figure 6.7.5 the m32170f4's virtual flash emulation area divided in units of 8 kbytes figure 6.7.6 the m32170f4's virtual flash emulation area divided in units of 4 kbytes note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 is assigned. note 2: when you access an 8-kbyte area (l bank) specified by virtual flash l bank registers 0-2, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 is assigned. note 2: when you access an 4-kbyte area (s bank) specified by virtual flash s bank registers 0,1, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. h'0000 0000 h'0000 2000 h'0080 4000 h'0080 6000 l bank 0 (8 kbytes) h'0000 4000 h'0007 e000 h'0007 c000 h'0080 8000 l bank 1 (8 kbytes) l bank 2 (8 kbytes) l bank 62 (8 kbytes) l bank 63 (8 kbytes) 8 kbytes 8 kbytes 8 kbytes 4 kbytes 4 kbytes h'0000 0000 h'0000 1000 h'0080 4000 h'0000 2000 h'0007 f000 h'0007 e000 h'0080 a000 h'0080 b000 s bank 0 (4 kbytes) s bank 1 (4 kbytes) s bank 2 (4 kbytes) s bank 126 (4 kbytes) s bank 127 (4 kbytes) 8 kbytes 8 kbytes 4 kbytes 4 kbytes 8 kbytes
6 6-48 ver.0.10 internal memory 6.7 virtual flash emulation function figure 6.7.7 the m32170f3's virtual flash emulation area divided in units of 8 kbytes figure 6.7.8 the m32170f3's virtual flash emulation area divided in units of 4 kbytes note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 is assigned. note 2: when you access an 8-kbyte area (l bank) specified by virtual flash l bank registers 0-2, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. note 1: if after setting the same bank area in multiple virtual flash bank registers, you enable the virtual flash emulation enable bit, the internal ram area selected in order of priority felbank0 > felbank1 > felbank2 > fesbank0 > fesbank1 is assigned. note 2: when you access an 4-kbyte area (s bank) specified by virtual flash s bank registers 0,1, its corresponding internal ram area is accessed. during virtual flash emulation mode, ram can be read or written to from both internal ram area and virtual flash setup area. h'0000 0000 h'0000 2000 h'0080 4000 h'0080 6000 l bank 0 (8 kbytes) h'0000 4000 h'0005 e000 h'0005 c000 h'0080 8000 l bank 1 (8 kbytes) l bank 2 (8 kbytes) l bank 46 (8 kbytes) l bank 47 (8 kbytes) 8 kbytes 8 kbytes 8 kbytes 4 kbytes 4 kbytes h'0000 0000 h'0000 1000 h'0080 4000 h'0000 2000 h'0005 f000 h'0005 e000 h'0080 a000 h'0080 b000 s bank 0 (4 kbytes) s bank 1 (4 kbytes) s bank 2 (4 kbytes) s bank 94 (4 kbytes) s bank 95 (4 kbytes) 8 kbytes 8 kbytes 4 kbytes 4 kbytes 8 kbytes
6 6-49 ver.0.10 internal memory 6.7 virtual flash emulation function figure 6.7.9 values set in the m32170f6's virtual flash bank register when divided in units of 8 kbytes figure 6.7.10 values set in the m32170f6's virtual flash bank register when divided in units of 4 kbytes note: set the seven bits a12-a18 of the start address (32-bit) of each l bank of flash memory divided every 8 kbytes in the virtual flash l bank register's l bank address (lbankad) bits. note: set the eight bits a12-a19 of the start address (32-bit) of each s bank of flash memory divided every 4 kbytes in the virtual flash s bank register's s bank address (sbankad) bits. h'000 0 0000 l bank start address of bank in flash memory l bank address (lbankad) bit set value h'000 0 2000 h'000 0 4000 h'000 b c000 h'000 b e000 h'00 h'02 h'04 h'bc h'be (note) l bank 0 l bank 1 l bank 2 l bank 94 l bank 95 h'000 0 0000 s bank start address of bank in flash memory s bank address (sbankad) bit set value h'000 0 1000 h'000 0 2000 h'000 b e000 h'000 b f000 h'00 h'01 h'02 h'be h'bf (note) s bank 0 s bank 1 s bank 2 s bank 190 s bank 191
6 6-50 ver.0.10 internal memory 6.7 virtual flash emulation function figure 6.7.11 values set in the m32170f4's virtual flash bank register when divided in units of 8 kbytes figure 6.7.12 values set in the m32170f4's virtual flash bank register when divided in units of 4 kbytes note: set the seven bits a12-a18 of the start address (32-bit) of each l bank of flash memory divided every 8 kbytes in the virtual flash l bank register's l bank address (lbankad) bits. note: set the eight bits a12-a19 of the start address (32-bit) of each s bank of flash memory divided every 4 kbytes in the virtual flash s bank register's s bank address (sbankad) bits. h'000 0 0000 l bank start address of bank in flash memory l bank address (lbankad) bit set value h'000 0 2000 h'000 0 4000 h'000 7 c000 h'000 7 e000 h'00 h'02 h'04 h'7c h'7e (note) l bank 0 l bank 1 l bank 2 l bank 62 l bank 63 h'000 0 0000 s bank start address of bank in flash memory s bank address (sbankad) bit set value h'000 0 1000 h'000 0 2000 h'000 7 e000 h'000 7 f000 h'00 h'01 h'02 h'7e h'7f (note) s bank 0 s bank 1 s bank 2 s bank 126 s bank 127
6 6-51 ver.0.10 internal memory 6.7 virtual flash emulation function figure 6.7.13 values set in the m32170f3's virtual flash bank register when divided in units of 8 kbytes figure 6.7.14 values set in the m32170f3's virtual flash bank register when divided in units of 4 kbytes note: set the seven bits a12-a18 of the start address (32-bit) of each l bank of flash memory divided every 8 kbytes in the virtual flash l bank register's l bank address (lbankad) bits. note: set the eight bits a12-a19 of the start address (32-bit) of each s bank of flash memory divided every 4 kbytes in the virtual flash s bank register's s bank address (sbankad) bits. h'000 0 0000 l bank start address of bank in flash memory l bank address (lbankad) bit set value h'000 0 2000 h'000 0 4000 h'000 5 c000 h'000 5 e000 h'00 h'02 h'04 h'5c h'5e (note) l bank 0 l bank 1 l bank 2 l bank 46 l bank 47 h'000 0 0000 s bank start address of bank in flash memory s bank address (sbankad) bit set value h'000 0 1000 h'000 0 2000 h'000 5 e000 h'000 5 f000 h'00 h'01 h'02 h'5e h'5f (note) s bank 0 s bank 1 s bank 2 s bank 94 s bank 95
6 6-52 ver.0.10 internal memory 6.7 virtual flash emulation function 6.7.2 entering virtual flash emulation mode to enter virtual flash emulation mode, set the flash control register 1 (fcnt1) femmod bit to 1. after entering virtual flash emulation mode, set the virtual flash bank register moden bit to 1 to enable the virtual flash emulation function. in virtual flash emulation mode also, the internal ram area (h'0080 4000 through h'0080 dfff for the m32170f6, or h'8080 4000 through h'0080 bfff for the m32170f4 and m32170f3) can be accessed as internal ram. figure 6.7.15 virtual flash emulation mode sequence set ram location address in virtual flash bank register lbankadn address a12-a18 sbankadn address a12-a19 write flash data to ram enable virtual flash emulation function modenln 1 modensn 1 settings completed go to virtual flash emulation mode femmod 1 settings completed
6 6-53 ver.0.10 internal memory 6.7 virtual flash emulation function 6.7.3 application example of virtual flash emulation mode by locating two ram areas in the same virtual flash area using the virtual flash emulation function, you can rewrite data in the flash memory successively. figure 6.7.16 application example of virtual flash emulation (1/2) replace area flash ram block 0 data write to ram0 (1) operation when reset (2) program operation using ram block 0 initial value (3) program operation changed from ram block 0 to ram block 1 bank xx bank xx specified ram block 0 ram block 1 replace flash ram block 0 data write to ram1 initial value bank xx ram block 1 bank xx specified ram block 0 replace flash ram block 0 initial value bank xx ram block 1 ram block 1 bank xx specified (settings invalid)
6 6-54 ver.0.10 internal memory 6.7 virtual flash emulation function figure 6.7.17 application example of virtual flash emulation (2/2) (6) go to item (2) note : valid area (4) program operation using ram block 1 bank xx specified ram block 1 replace flash ram block 0 data write to ram0 initial value bank xx ram block 1 (5) program operation changed from ram block 1 to ram block 0 bank xx specified ram block 0 replace flash ram block 0 initial value bank xx ram block 1 ram block 1 bank xx specified (settings invalid)
6 6-55 ver.0.10 internal memory 6.8 connecting to a serial programmer 6.8 connecting to a serial programmer when you rewrite the internal flash memory using a general-purpose serial programmer in boot flash e/w enable mode, you need to process the pins on the 32170 shown below to make them suitable for the serial programmer. table 6.8.1 processing the 32170 pins when using a serial programmer pin name pin number function remark fp mod0 reset sclki1 rxd1 txd1 p84 vcce vcci vss 156 154 153 121 120 119 118 37,51,80,114,139,157, 205 98,125,137,171,195,225 17,22,24,38,52,81,99, 115,127,129,138,158, 172,196,206,226 osc-vcc 21 xout 20 xin 19 osc-vss 18 vref0 vref1 61 227 avcc0 avcc1 62 228 avss0 avss1 79 5 fvcc 128 vdd 170 transfer clock input serial data input (receive data) serial data output (transmit data) transmit/receive enable output flash memory protect operation mode 1 reset clock input clock output pll circuit power supply pll circuit ground pll circuit control input vcnt 23 a-d converter reference voltage input analog power supply analog ground flash memory power supply ram backup power supply 5 v power supply ground mod1 155 operation mode 0 need to be pulled high connect to ground connect to 3.3 v power supply connect to 5 v power supply note: all other pins do not need to be processed. p83 117 transmit/receive control need to be pulled high need to be pulled high need to be pulled high connect to ground connect to ground connect to 5 v power supply connect to 3.3 v power supply connect to 3.3 v power supply 3.3 v power supply
6 6-56 ver.0.10 internal memory 6.8 connecting to a serial programmer the diagram below shows an example of user system configuration which has had a serial programmer connected. after the user system is powered on, the serial programmer writes to the flash memory in clock-synchronized serial mode. no communication problems associated with the oscillation frequency may occur. if the system uses any 32170 pins which will connect to a serial programmer, care must be taken to prevent adverse effects on the system when a serial programmer is connected. note that the serial programmer uses the addresses h'0000 0084 through h'0000 0093 as an area to check id for flash memory protection. figure 6.8.1 pin connection diagram note 1 : turn on the power to the user system before you write to the flash memory. note 2 : if the system circuit uses p83-p87, consideration must be taken for connection of a serial programmer. note 3 : p83 must have a high-level signal applied to it. note 4 : p64/sbi must be fixed high or low to ensure that interrupts will not be generated. note 5 : the pullup resistances of p83, p84, p86, and p87 must be set to suit system design conditions. note 6 : the typical pullup resistances of p83, p84, p86, and p87 are 4.7 to 10 k w . note 7 : all other ports, whether high or low, do not affect flash memory programming. aaa vref0, vref1 32170 vdd vcci avcc0, avcc1 osc-vcc vcce connects to 5 v power supply p85/txd1 p86/rxd1 p87/sclki1/sclko1 p84/sclki0/sclko0 connector various signals on flash programmer mod0 fp reset vss set microcomputer operating conditions xin xout vcnt avss0, avss1 oscvss to system circuit p83/rxd0 rxd (input) txd (output) sclko(output) busy (input) mod0 (output) fp (output) reset(output) gnd (output) 5v (input) user system circuit board fvcc mod1 connects to 3.3 v power supply
6 6-57 ver.0.10 6.9 precautions to be taken when rewriting flash memory the following describes precautions to be taken when you rewrite the flash memory using a general-purpose serial programmer in boot flash e/w enable mode. ? when you use the pins with the system that are used by a serial programmer, take measures not to affect the system when connecting a serial programmer. ? if the flash memory needs to be protected, set an appropriate id in the flash memory protect id verification area (h'0000 0084 through h'0000 0093). ? if the flash memory does not require protection, fill the entire flash memory protect id verification area (h'0000 0084 through h'0000 0093) with h'ff. internal memory 6.9 precautions to be taken when rewriting flash memory
6 6-58 ver.0.10 internal memory 6.9 precautions to be taken when rewriting flash memory ? this is a blank page. ?
chapter 7 chapter 7 reset 7.1 outline of reset 7.2 reset operation 7.3 internal state immediately after reset release 7.4 things to be considered after reset release
7 7-2 ver.0.10 7.1 outline of reset _____ the device is reset by applying a low-level signal to the reset input pin. the device is gotten out _____ of a reset state by releasing the reset input back high, upon which the reset vector entry address is set in the program counter (pc) and the program starts executing from the reset vector entry. 7.2 reset operation 7.2.1 reset at power-on _____ when powering on the device, hold the reset input low until its internal multiply-by-4 clock generator becomes oscillating stably. 7.2.2 reset during operation _____ to reset the device during operation, hold the reset input low for more than four clock periods of xin signal. 7.2.3 reset vector relocation during flash rewrite when placed in boot mode, the reset vector entry address is moved to the start address of the boot program space (address h'8000 0000). for details, refer to section 6.5, "programming of internal flash memory." reset 7.1 outline of reset
7 7-3 ver.0.10 reset 7.3 internal state immediately after reset release 7.3 internal state immediately after reset release the table below lists the register state of the device immediately after it has gotten out of reset. for details about the initial register state of each internal peripheral i/o, refer to each section in this manual where the relevant internal peripheral i/o is described. table 7.3.1 internal state immediately after reset register state after reset release psw (cr0) b'0000 0000 0000 0000 ??00 000? 0000 0000 (bsm, bie, bc bits = indeterminate) cbr (cr1) h'0000 0000 (c bit = 0) spi (cr2) indeterminate spu (cr3) indeterminate bpc (cr6) indeterminate pc h'0000 0000 (executed beginning with address h'0000 0000) (note) acc (accumulator) indeterminate note: when in boot mode, this changes to the start address of the boot program space (h'8000 0000).
7 7-4 ver.0.10 reset 7.4 things to be considered after reset release 7.4 things to be considered after reset release ? input/output ports after reset release, the 32170's input/output ports are disabled against input in order to prevent current from flowing through the port. to use any ports in input mode, enable them for input using the port input function enable register (pien) pien0 bit. for details, refer to section 8.3, "input/ output port related registers."
chapter 8 chapter 8 input/output ports and pin functions 8.1 outline of input/output ports 8.2 selecting pin functions 8.3 input/output port related registers 8.4 port peripheral circuits
8 8-2 ver.0.10 8.1 outline of input/output ports the 32170 has a total of 157 input/output ports from p0 to p22 (of which p5 is reserved for future use, however). these input/output ports can be set for input or output mode by a direction register. each input/output port serves as a dual-function or triple-function pin, sharing the pin with other internal peripheral i/o or extended external bus signal line. pin functions are selected depending on the device's operation mode you choose or by setting the input/output port's operation mode register. (if any internal peripheral i/o has still another function, you need to set the register provided for that peripheral i/o.) as a new function, the 32170 internally contains a port input function enable bit that can be used to prevent current from flowing into the input ports. this helps to simplify the software and hardware processing to be performed immediately after reset or during flash rewrite. to use any ports in input mode, you need to set the port input function enable bit accordingly. the input/output ports are outlined in the next pages. input/output ports and pin functions 8.1 outline of input/output ports
8 8-3 ver.0.10 input/output ports and pin functions 8.1 outline of input/output ports table 8.1.1 outline of input/output ports item specification number of ports total 157 lines p0 : p00 - p07 (8 lines) p1 : p10 - p17 (8 lines) p2 : p20 - p27 (8 lines) p3 : p30 - p37 (8 lines) p4 : p41 - p47 (7 lines) p6 : p61 - p67 (7 lines) p7 : p70 - p77 (8 lines) p8 : p82 - p87 (6 lines) p9 : p93 - p97 (5 lines) p10 : p100 - p107 (8 lines) p11 : p110 - p117 (8 lines) p12 : p124 - p127 (4 lines) p13 : p130 - p137 (8 lines) p14 : p140 - p147 (8 lines) p15 : p150 - p157 (8 lines) p16 : p160 - p167 (8 lines) p17 : p172 - p177 (6 lines) p18 : p180 - p187 (8 lines) p19 : p190 - p197 (8 lines) p20 : p200 - p203 (4 lines) p21 : p210 - p217 (8 lines) p22 : p220 - p225 (6 lines) port function the input/output ports can individually be set for input or output mode using the direction control register provided for each input/output port. (however, p64 is an ___ sbi input-only port and p221 is a can input-only port.) pin function shared with peripheral i/o or extended external signals to serve dual functions (or with two or more peripheral i/o functions to serve multiple functions) pin function switchover p0 - p4, p224, p225 : depends on cpu operation mode (determined by setting mod0 and mod1 pins) p6 - p22 : as set by each input/output port's operation mode register (however, peripheral i/o pin functions are selected by peripheral i/o registers.)
8 8-4 ver.0.10 input/output ports and pin functions 8.2 selecting pin functions 8.2 selecting pin functions each input/output port serves dual functions sharing the pin with other internal peripheral i/o or extended external bus signal line (or triple functions sharing the pin with two or more peripheral i/o functions). pin functions are selected depending on the device's operation mode you choose or by setting the input/output port's operation mode register. p0-p4, p224, and p225, when the cpu is set to operate in extended external mode or processor mode, all are switched to serve as signal pins for external access. the cpu operation mode is determined by setting the mod0 and mod1 pins (see the table below). table 8.2.1 cpu operation mode and pin functions of p0-p4, p224, and p225 mod0 mod1 operation mode pin functions of p0-p4, p224, and p225 vss vss single-chip mode input/output port pin vss vcce extended external mode extended external signal pin vcce vss processor mode vcce vcce reserved (use inhibited) note: vcce and vss are connected to +5 v and gnd, respectively. p6-p22 (except p64, p221, p224, and p225) have their pin functions switched between input/ output port pins and internal peripheral i/o pins by setting each port's operation mode register. if any internal peripheral i/o has multiple pin functions, you need to set the register provided for that peripheral i/o to select the desired pin function. note that settings of fp pin and mod1 pin during internal flash memory write operation do not affect the pin functions.
8 8-5 ver.0.10 input/output ports and pin functions 8.2 selecting pin functions figure 8.2.1 input/output ports and pin function assignments note 1: pin functions are switched over by setting mod0 and mod1 pins. note 2: pin functions are switched over by setting mod0 and mod1 pins. also, use of this pin requires caution because it has a debug event function. p0 p1 p2 p3 p4 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p5 db0 012 3456 7 db1 db2 db3 db4 db5 db6 db7 db8 db9 db10 db11 db12 db13 db14 db15 a23 a24 a25 a26 a27 a28 a29 a30 a15 a16 a17 a18 a19 a20 a21 a22 blw/ ble bhw/ bhe rd cs0 cs1 a13 a14 (p61) (p62) (p63) sbi sclki4/ sclko4 adtrg bclk/ wr wait hreq hack rtdtxd rtdrxd rtdack rtdclk txd0 rxd0 sclki0/ sclko0 txd1 rxd1 sclki1/ sclko1 to16 to17 to18 to19 to20 to11 to12 to13 to14 to15 to10 to9 to8 to3 to4 to5 to6 to7 to2 to1 to0 tclk0 tclk1 tclk2 tclk3 tin16 tin17 tin18 tin19 tin20 tin21 tin22 tin23 tin8 tin9 tin10 tin11 tin12 tin13 tin14 tin15 tin0 tin1 tin2 tin3 tin4 tin5 tin6 tin7 settings of cpu operation mode (note 1) (reserved) settings of input/ output port operation mode register p16 to21 to22 to23 to24 to25 to26 to27 to28 p17 tin24 tin25 txd2 rxd2 txd3 rxd3 p18 p19 to29 to30 to31 to32 to33 to34 to35 to36 p20 txd4 rxd4 rxd5 p21 to37 to38 to39 to40 to41 to42 to43 to44 p22 ctx crx (p222) (p223) a11 (note 2) a12 (note 2) tin26 tin27 tin28 tin29 tin30 tin31 tin32 tin33 txd5 sclki5/ sclko5
8 8-6 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers 8.3 input/output port related registers included in the 32170 as input/output port related registers are the port data registers, port direction registers, and port operation mode registers. of these, the port operation mode registers are provided for only p6-p22. ports p0-p4, p224, and p225 have their pin functions determined by setting the cpu operation mode (fp, mod0, and mod1 pins). port p5 is reserved for future use. the tables below show an input/output port related register map. figure 8.3.1 input/output port related register map (1/2) address d0 d7 +0 address d8 d15 blank addresses are reserved. p1 data register (p1data) p3 data register (p3data) p7 data register (p7data) p9 data register (p9data) p11 data register (p11data) p13 data register (p13data) p15 data register (p15data) p1 direction register (p1dir) p3 direction register (p3dir) p7 direction register (p7dir) p9 direction register (p9dir) p11 direction register (p11dir) p17 data register (p17data) p19 data register (p19data) p21 data register (p21data) p13 direction register (p13dir) p15 direction register (p15dir) p17 direction register (p17dir) p19 direction register (p19dir) p21 direction register (p21dir) h'0080 0700 h'0080 0702 h'0080 0704 h'0080 0706 h'0080 0708 h'0080 070a h'0080 070c h'0080 070e h'0080 0720 h'0080 0722 h'0080 0724 h'0080 0726 h'0080 0728 h'0080 072a h'0080 072c h'0080 072e h'0080 0710 h'0080 0730 h'0080 0712 h'0080 0714 h'0080 0716 h'0080 0732 h'0080 0734 h'0080 0736 p0 data register (p0data) p2 data register (p2data) p4 data register (p4data) p6 data register (p6data) p8 data register (p8data) p10 data register (p10data) p12 data register (p12data) p14 data register (p14data) p0 direction register (p0dir) p2 direction register (p2dir) p4 direction register (p4dir) p6 direction register (p6dir) p8 direction register (p8dir) p10 direction register (p10dir) p16 data register (p16data) p18 data register (p18data) p20 data register (p20data) p22 data register (p22data) p12 direction register (p12dir) p14 direction register (p14dir) p16 direction register (p16dir) p18 direction register (p18dir) p20 direction register (p20dir) p22 direction register (p22dir) +1 address
8 8-7 ver.0.10 8.3.2 input/output port related register map (2/2) input/output ports and pin functions 8.3 input/output port related registers p7 operation mode register (p7mod) p9 operation mode register (p9mod) p11 operation mode register (p11mod) p13 operation mode register (p13mod) p15 operation mode register (p15mod) p17 operation mode register (p17mod) port input function enable register (pien) p19 operation mode register (p19mod) p21 operation mode register (p21mod) p6 operation mode register (p6mod) p8 operation mode register (p8mod) p10 operation mode register (p10mod) p12 operation mode register (p12mod) p14 operation mode register (p14mod) p16 operation mode register (p16mod) p18 operation mode register (p18mod) p20 operation mode register (p20mod) p22 operation mode register (p22mod) h'0080 0746 h'0080 0748 h'0080 074a h'0080 074c h'0080 074e h'0080 0750 h'0080 0744 h'0080 0752 h'0080 0754 h'0080 0756 blank addresses are reserved. address d0 d7 +0 address d8 d15 +1 address
8 8-8 ver.0.10 8.3.1 port data registers n p0 data register (p0data) n p1 data register (p1data) n p2 data register (p2data) n p3 data register (p3data) n p4 data register (p4data) n p6 data register (p6data) n p7 data register (p7data) n p8 data register (p8data) n p9 data register (p9data) n p10 data register (p10data) n p11 data register (p11data) n p12 data register (p12data) n p13 data register (p13data) n p14 data register (p14data) n p15 data register (p15data) n p16 data register (p16data) n p17 data register (p17data) n p18 data register (p18data) n p19 data register (p19data) n p20 data register (p20data) n p21 data register (p21data) n p22 data register (p22data) input/output ports and pin functions 8.3 input/output port related registers d0123456d7 ( d8 9 10 11 12 13 14 d15 ) pn0dt pn1dt pn2dt pn3dt pn4dt pn5dt pn6dt pn7dt note: n = 0 to 22 (except for p5)
8 8-9 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers d bit name function r w 0 pn0dt (port pn0 data) depending on how the port direction register is set 1 pn1dt (port pn1 data) ? when direction bit = 0 (input mode) 2 pn2dt (port pn2 data) 0: port input pin = low 3 pn3dt (port pn3 data) 1: port input pin = high 4 pn4dt (port pn4 data) ? when direction bit = 1 (output mode) 5 pn5dt (port pn5 data) 0: port output latch = low 6 pn6dt (port pn6 data) 1: port output latch = high 7 pn7dt (port pn7 data) note 1: the following bits have no functions assigned (when read, the bit = 0; writing to the bit has no effect). note 2: port p64 is input mode-only. writing to the p64dt bit has no effect. note 3: port p221 is input mode-only. writing to the p221dt bit has no effect. note 4: ports p80 and p81 are input mode-only. writing to the p80dt and p81dt bits has no effect. when read out, p80 shows the mod0 pin level and p81 shows the mod1 pin level. the p80dt and p81dt bits are write-protected.
8 8-10 ver.0.10 8.3.2 port direction registers n p0 direction register (p0dir) n p1 direction register (p1dir) n p2 direction register (p2dir) n p3 direction register (p3dir) n p4 direction register (p4dir) n p6 direction register (p6dir) n p7 direction register (p7dir) n p8 direction register (p8dir) n p9 direction register (p9dir) n p10 direction register (p10dir) n p11 direction register (p11dir) n p12 direction register (p12dir) n p13 direction register (p13dir) n p14 direction register (p14dir) n p15 direction register (p15dir) n p16 direction register (p16dir) n p17 direction register (p17dir) n p18 direction register (p18dir) n p19 direction register (p19dir) n p20 direction register (p20dir) n p21 direction register (p21dir) n p22 direction register (p22dir) input/output ports and pin functions 8.3 input/output port related registers d0123456d7 ( d8 9 10 11 12 13 14 d15 ) pn0dir pn1dir pn2dir pn3dir pn4dir pn5dir pn6dir pn7dir note: n = 0 to 22 (except for p5)
8 8-11 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers d bit name function r w 0 pn0dir (port pn0 direction bit) 0: input mode (when reset) 1 pn1dir (port pn1 direction bit) 1: output mode 2 pn2dir (port pn2 direction bit) 3 pn3dir (port pn3 direction bit) 4 pn4dir (port pn4 direction bit) 5 pn5dir (port pn5 direction bit) 6 pn6dir (port pn6 direction bit) 7 pn7dir (port pn7 direction bit) note 1: the following bits have no functions assigned (when read, the bit = 0; writing to the bit has no effect). note 2: when reset, all ports are placed in input mode. note 3: port p64 is input mode-only. the register does not have a p64dir bit. note 4: ports p80 and p81 are input mode-only. the register does not have p80dir and p81dir bits. note 5: port p221 is input mode-only. the register does not have a p221dir bit.
8 8-12 ver.0.10 8.3.3 port operation mode registers n p6 operation mode register (p6mod) input/output ports and pin functions 8.3 input/output port related registers d0123456d7 p65mod p66mod p67mod d bit name function r w 0 - 4 no functions assigned 0 5 p65mod 0 : p65 (port p65 operation mode) 1 : sclki4 / sclko4 6 p66mod 0 : p66 (port p66 operation mode) 1 : sclki5 / sclko5 7 p67mod 0 : p67 (port p67 operation mode) _____ 1 : adtrg note 1: port 60 is not accommodated. note 2: ports p61-p63 are always input/output ports (single-function pins). ___ note 3: port p64 is an sbi input-only pin. the pin level can be verified by reading the p64 data register.
8 8-13 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p7 operation mode register (p7mod) d8 9 1011121314d15 p70mod p71mod p72mod p73mod p74mod p75mod p76mod p77mod d bit name function r w 8 p70mod 0 : p70 (port p70 operation mode) __ 1 : bclk / wr 9 p71mod 0 : p71 (port p71 operation mode) ____ 1 : wait 10 p72mod 0 : p72 (port p72 operation mode) ____ 1 : hreq 11 p73mod 0 : p73 (port p73 operation mode) ____ 1 : hack 12 p74mod 0 : p74 (port p74 operation mode) 1 : rtdtxd 13 p75mod 0 : p75 (port p75 operation mode) 1 : rtdrxd 14 p76mod 0 : p76 (port p76 operation mode) 1 : rtdack 15 p77mod 0 : p77 (port p77 operation mode) 1 : rtdclk
8 8-14 ver.0.10 n p8 operation mode register (p8mod) input/output ports and pin functions 8.3 input/output port related registers d0123456d7 p82mod p83mod p84mod p85mod p86mod p87mod d bit name function r w 0, 1 no functions assigned 0 2 p82mod 0 : p82 (port p82 operation mode) 1 : txd0 3 p83mod 0 : p83 (port p83 operation mode) 1 : rxd0 4 p84mod 0 : p84 (port p84 operation mode) 1 : sclki0 / sclko0 5 p85mod 0 : p85 (port p85 operation mode) 1 : txd1 6 p86mod 0 : p86 (port p86 operation mode) 1 : rxd1 7 p87mod 0 : p87 (port p87 operation mode) 1 : sclki1 / sclko1 note : ports p80 and p81 are not accommodated.
8 8-15 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p9 operation mode register (p9mod) d8 9 1011121314d15 p93mod p94mod p95mod p96mod p97mod d bit name function r w 8 - 10 no functions assigned 0 11 p93mod 0 : p93 (port p93 operation mode) 1 : to16 12 p94mod 0 : p94 (port p94 operation mode) 1 : to17 13 p95mod 0 : p95 (port p95 operation mode) 1 : to18 14 p96mod 0 : p96 (port p96 operation mode) 1 : to19 15 p97mod 0 : p97 (port p97 operation mode) 1 : to20 note : ports p90 - p92 are not accommodated.
8 8-16 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p10 operation mode register (p10mod) d0123456d7 p100mod p101mod p102mod p103mod p104mod p105mod p106mod p107mod d bit name function r w 0 p100mod 0 : p100 (port p100 operation mode) 1 : to8 1 p101mod 0 : p101 (port p101 operation mode) 1 : to9 2 p102mod 0 : p102 (port p102 operation mode) 1 : to10 3 p103mod 0 : p103 (port p103 operation mode) 1 : to11 4 p104mod 0 : p104 (port p104 operation mode) 1 : to12 5 p105mod 0 : p105 (port p105 operation mode) 1 : to13 6 p106mod 0 : p106 (port p106 operation mode) 1 : to14 7 p107mod 0 : p107 (port p107 operation mode) 1 : to15
8 8-17 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p11 operation mode register (p11mod) d8 9 1011121314d15 p110mod p111mod p112mod p113mod p114mod p115mod p116mod p117mod d bit name function r w 8 p110mod 0 : p110 (port p110 operation mode) 1 : to0 9 p111mod 0 : p111 (port p111 operation mode) 1 : to1 10 p112mod 0 : p112 (port p112 operation mode) 1 : to2 11 p113mod 0 : p113 (port p113 operation mode) 1 : to3 12 p114mod 0 : p114 (port p114 operation mode) 1 : to4 13 p115mod 0 : p115 (port p115 operation mode) 1 : to5 14 p116mod 0 : p116 (port p116 operation mode) 1 : to6 15 p117mod 0 : p117 (port p117 operation mode) 1 : to7
8 8-18 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p12 operation mode register (p12mod) d0123456d7 p124mod p125mod p126mod p127mod d bit name function r w 0 - 3 no functions assigned 0 4 p124mod 0 : p124 (port p124 operation mode) 1 : tclk0 5 p125mod 0 : p125 (port p125 operation mode) 1 : tclk1 6 p126mod 0 : p126 (port p126 operation mode) 1 : tclk2 7 p127mod 0 : p127 (port p127 operation mode) 1 : tclk3 note : ports p120 - p123 are not accommodated.
8 8-19 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p13 operation mode register (p13mod) d8 9 1011121314d15 p130mod p131mod p132mod p133mod p134mod p135mod p136mod p137mod d bit name function r w 8 p130mod 0 : p130 (port p130 operation mode) 1 : tin16 9 p131mod 0 : p131 (port p131 operation mode) 1 : tin17 10 p132mod 0 : p132 (port p132 operation mode) 1 : tin18 11 p133mod 0 : p133 (port p133 operation mode) 1 : tin19 12 p134mod 0 : p134 (port p134 operation mode) 1 : tin20 13 p135mod 0 : p135 (port p135 operation mode) 1 : tin21 14 p136mod 0 : p136 (port p136 operation mode) 1 : tin22 15 p137mod 0 : p137 (port p137 operation mode) 1 : tin23
8 8-20 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p14 operation mode register (p14mod) d0123456d7 p140mod p141mod p142mod p143mod p144mod p145mod p146mod p147mod d bit name function r w 0 p140mod 0 : p140 (port p140 operation mode) 1 : tin8 1 p141mod 0 : p141 (port p141 operation mode) 1 : tin9 2 p142mod 0 : p142 (port p142 operation mode) 1 : tin10 3 p143mod 0 : p143 (port p143 operation mode) 1 : tin11 4 p144mod 0 : p144 (port p144 operation mode) 1 : tin12 5 p145mod 0 : p145 (port p145 operation mode) 1 : ttin13 6 p146mod 0 : p146 (port p146 operation mode) 1 : tin14 7 p147mod 0 : p147 (port p147 operation mode) 1 : tin15
8 8-21 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p15 operation mode register (p15mod) d8 9 1011121314d15 p150mod p151mod p152mod p153mod p154mod p155mod p156mod p157mod d bit name function r w 8 p150mod 0 : p150 (port p150 operation mode) 1 : tin0 9 p151mod 0 : p151 (port p151 operation mode) 1 : tin1 10 p152mod 0 : p152 (port p152 operation mode) 1 : tin2 11 p153mod 0 : p153 (port p153 operation mode) 1 : tin3 12 p154mod 0 : p154 (port p154 operation mode) 1 : tin4 13 p155mod 0 : p155 (port p155 operation mode) 1 : tin5 14 p156mod 0 : p156 (port p156 operation mode) 1 : tin6 15 p157mod 0 : p157 (port p157 operation mode) 1 : tin7
8 8-22 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p16 operation mode register (p16mod) d0123456d7 p160mod p161mod p162mod p163mod p164mod p165mod p166mod p167mod d bit name function r w 0 p160mod 0 : p160 (port p160 operation mode) 1 : to21 1 p161mod 0 : p161 (port p161 operation mode) 1 : to22 2 p162mod 0 : p162 (port p162 operation mode) 1 : to23 3 p163mod 0 : p163 (port p163 operation mode) 1 : to24 4 p164mod 0 : p164 (port p164 operation mode) 1 : to25 5 p165mod 0 : p165 (port p165 operation mode) 1 : to26 6 p166mod 0 : p166 (port p166 operation mode) 1 : to27 7 p167mod 0 : p167 (port p167 operation mode) 1 : to28
8 8-23 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p17 operation mode register (p17mod) d8 9 1011121314d15 p172mod p173mod p174mod p175mod p176mod p177mod d bit name function r w 8, 9 no functions assigned 0 10 p172mod 0 : p172 (port p172 operation mode) 1 : tin24 11 p173mod 0 : p173 (port p173 operation mode) 1 : tin25 12 p174mod 0 : p174 (port p174 operation mode) 1 : txd2 13 p175mod 0 : p175 (port p175 operation mode) 1 : rxd2 14 p176mod 0 : p176 (port p176 operation mode) 1 : txd3 15 p177mod 0 : p177 (port p177 operation mode) 1 : rxd3 note : ports p170 and p171 are not accommodated.
8 8-24 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p18 operation mode register (p18mod) d0123456d7 p180mod p181mod p182mod p183mod p184mod p185mod p186mod p187mod d bit name function r w 0 p180mod 0 : p180 (port p180 operation mode) 1 : to29 1 p181mod 0 : p181 (port p181 operation mode) 1 : to30 2 p182mod 0 : p182 (port p182 operation mode) 1 : to31 3 p183mod 0 : p183 (port p183 operation mode) 1 : to32 4 p184mod 0 : p184 (port p184 operation mode) 1 : to33 5 p185mod 0 : p185 (port p185 operation mode) 1 : to34 6 p186mod 0 : p186 (port p186 operation mode) 1 : to35 7 p187mod 0 : p187 (port p187 operation mode) 1 : to36
8 8-25 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p19 operation mode register (p19mod) d8 9 1011121314d15 p190mod p191mod p192mod p193mod p194mod p195mod p196mod p197mod d bit name function r w 8 p190mod 0 : p190 (port p190 operation mode) 1 : tin26 9 p191mod 0 : p191 (port p191 operation mode) 1 : tin27 10 p192mod 0 : p192 (port p192 operation mode) 1 : tin28 11 p193mod 0 : p193 (port p193 operation mode) 1 : tin29 12 p194mod 0 : p194 (port p194 operation mode) 1 : tin30 13 p195mod 0 : p195 (port p195 operation mode) 1 : tin31 14 p196mod 0 : p196 (port p196 operation mode) 1 : tin32 15 p197mod 0 : p197 (port p197 operation mode) 1 : tin33
8 8-26 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p20 operation mode register (p20mod) d0123456d7 p200mod p201mod p202mod p203mod d bit name function r w 0 p200mod 0 : p200 (port p200 operation mode) 1 :txd4 1 p201mod 0 : p201 (port p201 operation mode) 1 : rxd4 2 p202mod 0 : p202 (port p202 operation mode) 1 : txd5 3 p203mod 0 : p203 (port p203 operation mode) 1 : rxd5 4 - 7 no functions assigned 0 note : ports p204 - p207 are not accommodated.
8 8-27 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p21 operation mode register (p21mod) d8 9 1011121314d15 p210mod p211mod p212mod p213mod p214mod p215mod p216mod p217mod d bit name function r w 8 p210mod 0 : p210 (port p210 operation mode) 1 : to37 9 p211mod 0 : p211 (port p211 operation mode) 1 : to38 10 p212mod 0 : p212 (port p212 operation mode) 1 : to39 11 p213mod 0 : p213 (port p213 operation mode) 1 : to40 12 p214mod 0 : p214 (port p214 operation mode) 1 : to41 13 p215mod 0 : p215 (port p215 operation mode) 1 : to42 14 p216mod 0 : p216 (port p216 operation mode) 1 : to43 15 p217mod 0 : p217 (port p217 operation mode) 1 : to44
8 8-28 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n p22 operation mode register (p22mod) d0123456d7 p220mod p224mod p225mod d bit name function r w 0 p220mod 0 : p220 (port p220 operation mode) 1 : ctx 1 - 3 no functions assigned 0 4 p224mod 0 : p224 (port p224 operation mode) 1 : use inhibited 5 p225mod 0 : p225 (port p225 operation mode) 1 : use inhibited 6 - 7 no functions assigned 0 note 1: p221 is a can input-only pin. note 2: p222-p223 are always input/output ports (single-function pins). note 3: p224 and p225 have their pin functions changed depending on how the mod0 and mod1 pins are set. also, use of these ports requires caution because they have a debug event function. note 4: p226 and p227 are not accommodated.
8 8-29 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers n port input function enable register (pien) d8 9 1011121314d15 pien0 d bit name function r w 8 - 14 no functions assigned 0 15 pien0 0 : disables input (to prevent current from flowing in) (port input function enable bit) 1 : enables input this register is provided to prevent current from flowing into the port input pin. because after reset this register is set to disable input, it must be set to 1 before input can be processed. during boot mode, all pins shared with serial i/o function are enabled for input, so that when rewriting the flash memory via serial communication, you can set this register to 0 to prevent current from flowing in from any pins other than serial i/o function. the next page lists the pins that can be controlled by the port input function enable register in each mode.
8 8-30 ver.0.10 input/output ports and pin functions 8.3 input/output port related registers mode name controllable pins noncontrollable pins p00 - p07, p10 - p17, p20 - p27 p64, p221, fp p30 -p37 , p41 - p47, p61 - p63 single chip p65 - p67, p70 - p77, p82 - p87 p93 - p97, p100 - p107, p110 - p117 p124 - p127, p130 - p137, p140 - p147 p150 - p157, p160 - p167, p172 - p177 p180 - p187, p190 - p197, p200 - p203 p210 - p217, p220, p222 - p225 p61 - p63, p65 - p67, p70 - p77 p00 - p07, p10 - p17 p82 - p87, p93 -p97, p100 - p107 p20 - p27, p30 - p37 extended external p110 - p117, p124 - p127, p130 - p137 p41 - p47, p64, p221, p224 microprocessor p140 - p147, p150 - p157, p160 - p167 p225, fp p172 - p177, p180 - p187, p190 - p197 p200 - p203, p210 - p217, p220 p222 - p223 p00 - p07, p10 - p17, p20 - p27 p64, p66, p82 - p87 p30 -p37 , p41 - p47, p61 - p63 p174 - p177, p200 - p203 boot (single chip) p67, p70 - p77, p93 - p97 p221, fp p100 - p107, p110 - p117, p124 - p127 p130 - p137, p140 - p147, p150 - p157 p160 - p167, p172 - p173, p180 - p187 p190 - p197, p210 - p217, p220 p222 - p225
8 8-31 ver.0.10 input/output ports and pin functions 8.4 port peripheral circuits 8.4 port peripheral circuits figures 8.4.1 through 8.4.4 show the peripheral circuit diagrams of the input/output ports described in the preceding pages. figure 8.4.1 port peripheral circuit diagram (1) note 2: denotes pins. note 1: ports p00-p07, p10-p17, p20-p27, p30-p37, p41-p47, and p224-p225 when operating in extended external mode or processor mode, function as external bus interface control signals, but their functional description in this block diagram is omitted. p00 - p07 (db0-db7) p10 - p17 (db8-db15) p20 - p27 (a23-a30) p30 - p37 (a15-a22) ___ ___ p41 (blw / ble) ___ ___ p42 (bhw / bhe) __ p43 (rd) ___ p44 (cs0) ___ p45 (cs1) p46 - p47 (a13-a14) p61 - p63 p224 - p225 (a11-a12) p222 - p223 _____ p67 (adtrg) p75 (rtdrxd) p77 (rtdclk) p83 (rxd0) p86 (rxd1) p124 - p127 (tclk0-tclk3) p130 - p137 (tin16-tin23) p140 - p147 (tin8-tin15) p150 - p157 (tin0-tin7) p172, p173 (tin24, tin25) p175 (rxd2) p177 (rxd3) p190 - p197 (tin26-tin33) p201 (rxd4) p203 (rxd5) data bus (db0 - db15) operation mode register port output latch direction register input function enable peripheral function input data bus (db0 - db15) port output latch direction register input function enable
8 8-32 ver.0.10 input/output ports and pin functions 8.4 port peripheral circuits figure 8.4.2 port peripheral circuit diagram (2) note : denotes pins. ___ p64 (sbi) p221 / crx ____ p72 (hreq) sbi operation mode register hreq data bus (db0 - db15) port output latch direction register input function enable data bus (db0 - db15)
8 8-33 ver.0.10 input/output ports and pin functions 8.4 port peripheral circuits figure 8.4.3 port peripheral circuit diagram (3) note : denotes pins. ____ p71 (wait) __ p70 (bclk / wr) ____ p73 (hack) p74 (rtdtxd) p76 (rtdack) p82 (txd0) p85 (txd1) p93 - p97 (to16-to20) p100 - p107 (to8-to15) p110 - p117 (to0-to7) p160 - p167 (to21 - to28) p174 (txd2) p176 (txd3) p180 - p187 (to29-to36) p200 (txd4) p202 (txd5) p210 - p217 (to37-to44) p220 (ctx) wait data bus (db0 - db15) operation mode register port output latch direction register input function enable peripheral function input data bus (db0 - db15) port output latch direction register input function enable operation mode register
8 8-34 ver.0.10 input/output ports and pin functions 8.4 port peripheral circuits figure 8.4.4 port peripheral circuit diagram (4) note : denotes pins. p84 (sclki0, sclko0) p87 (sclki1, sclko1) p65 (sclki14, sclko4) p66 (sclki15, sclko5) mod0 mod1 fp _____ reset sclkii input sclkoi output reset mod0 , mod1 fp operation mode register data bus (db0 - db15) port output latch direction register input function enable uart/csio function select bit internal/external clock select bit
chapter 9 chapter 9 dmac 9.1 outline of the dmac 9.2 dmac related registers 9.3 functional description of the dmac 9.4 precautions about the dmac
9 9-2 ver.0.10 9.1 outline of the dmac the 32170 contains a 10 channel-dma (direct memory access) controller. it allows you to transfer data at high speed between internal peripheral i/os, between internal ram and internal peripheral i/o, and between internal rams, as requested by a software trigger or from an internal peripheral i/o. table 9.1.1 outline of the dmac item description number of channel 10 channels transfer request ? software trigger ? request from internal peripheral i/os: a-d converter, multijunction timer, or serial i/o (reception completed, transmit buffer empty) ? transfer operation can be cascaded between dma channels (note) maximum number 256 times of times transferred transferable ? 64 kbytes (address space from h'0080 0000 to h'0080 ffff) address space ? transfers between internal peripheral i/os, between internal ram and internal peripheral i/o, between internal rams are supported transfer data size 16 or 8 bits transfer method single transfer dma (control of the internal bus is relinquished for each transfer performed), dual-address transfer transfer mode single transfer mode direction of transfer one of three modes can be selected for the source and destination: ? address fixed ? address incremental ? ring buffered channel priority channel 0 > channel 1 > channel 2 > channel 3 > channel 4 > channel 5 > channel 6 > channel 7 > channel 8 > channel 9 (priority is fixed) maximum transfer rate 13.3 mbytes per second (with 20 mhz internal peripheral clock) interrupt request group interrupt request can be generated when each transfer count register underflows. transfer area 64 kbytes from h'0080 0000 to h'0080 ffff (transferable in the entire internal ram/sfr area) note: transfer operation can be cascaded between dma channels as shown below. completion of one transfer in channel 0 starts dma transfer in channel 1 completion of one transfer in channel 1 starts dma transfer in channel 2 completion of one transfer in channel 2 starts dma transfer in channel 0 completion of one transfer in channel 3 starts dma transfer in channel 4 completion of one transfer in channel 5 starts dma transfer in channel 6 completion of one transfer in channel 6 starts dma transfer in channel 7 completion of one transfer in channel 7 starts dma transfer in channel 5 completion of one transfer in channel 8 starts dma transfer in channel 9 completion of all dma transfers in channel 0 (transfer count register underflow) starts dma transfer in channel 5 dmac 9.1 outline of the dmac
9 9-3 ver.0.10 dmac 9.1 outline of the dmac figure 9.1.1 block diagram of the dmac dma request selector a-d conversion completed dma channel 0 software start mjt (tin13 input signal) one dma0 transfer completed internal bus software start software start serial i/o0 (reception completed) one dma2 transfer completed one dma3 transfer completed mjt (tio8_udf) mjt (input event bus 2) mjt (output event bus 0) mjt (tin19 input signal) software start mjt (tin18 input signal) one dma1 transfer completed mjt (output event bus 1) software start serial i/o0 (transmit buffer empty) serial i/o1 (reception completed) source address register destination address register determination block dma start mjt (tin0 input signal) all dma0 transfers completed (udf) software start mjt (tin1 input signal) one dma5 transfer completed software start one dma7 transfer completed serial i/o2 (reception completed) mjt (tin20 input signal) serial i/o1 (transmit buffer empty) software start mjt (tin2 input signal) one dma6 transfer completed serial i/o2 (transmit buffer empty) software start mjt (input event bus 0) serial i/o3 (reception completed) mjt (tin7 input signal) source destination transfer count interrupt request internal bus arbitration software start mjt (tin8 input signal) one dma8 transfer completed serial i/o3 (transmit buffer empty) transfer count register udf dma request selector dma channel 1 udf source destination transfer count dma request selector dma channel 2 udf source destination transfer count dma request selector dma channel 3 udf source destination transfer count dma request selector dma channel 4 udf source destination transfer count dma request selector dma channel 5 udf source destination transfer count dma request selector dma channel 6 udf source destination transfer count dma request selector dma channel 7 udf source destination transfer count dma request selector dma channel 8 udf source destination transfer count dma request selector dma channel 9 udf determination block dma start internal bus arbitration interrupt request
9 9-4 ver.0.10 dmac 9.2 dmac related registers 9.2 dmac related registers the diagram below shows a memory map of dmac related registers. figure 9.2.1 dmac related register map (1/2) address d0 d7 +0 address +1 address d8 d15 note: the re g isters enclosed in thick frames can only be accessed in halfwords. dma0-4 interrupt request status register (dm04itst) h'0080 0400 h'0080 0414 h'0080 0416 h'0080 0418 h'0080 0410 h'0080 0412 h'0080 0422 h'0080 0424 h'0080 0426 h'0080 0428 h'0080 042a h'0080 0420 h'0080 0432 h'0080 0434 h'0080 0436 h'0080 0438 h'0080 043a h'0080 0430 h'0080 0408 h'0080 042c h'0080 042e h'0080 043c h'0080 043e h'0080 041a h'0080 041c h'0080 041e blank addresses are reserved. dma0 source address register (dm0sa) dma0 destination address register (dm0da) dma0-4 interrupt mask register (dm04itmk) dma5-9 interrupt request status register (dm59itst) dma5-9 interrupt mask register (dm59itmk) dma0 channel control register (dm0cnt) dma0 transfer count register (dm0tct) dma5 source address register (dm5sa) dma5 destination address register (dm5da) dma5 channel control register (dm5cnt) dma5 transfer count register (dm5tct) dma1 source address register (dm1sa) dma1 destination address register (dm1da) dma1 channel control register (dm1cnt) dma1 transfer count register (dm1tct) dma6 source address register (dm6sa) dma6 destination address register (dm6da) dma6 channel control register (dm6cnt) dma6 transfer count register (dm6tct) dma2 source address register (dm2sa) dma2 destination address register (dm2da) dma2 channel control register (dm2cnt) dma2 transfer count register (dm2tct) dma7 source address register (dm7sa) dma7 destination address register (dm7da) dma7 channel control register (dm7cnt) dma7 transfer count register (dm7tct)
9 9-5 ver.0.10 dmac 9.2 dmac related registers figure 9.2.2 dmac related register map (2/2) address d0 d7 +0 address +1 address d8 d15 note: the registers enclosed in thick frames can only be accessed in halfwords. h'0080 0440 h'0080 044c h'0080 044e h'0080 0450 h'0080 0448 h'0080 044a h'0080 045a h'0080 045c h'0080 045e h'0080 0460 h'0080 0462 h'0080 0458 h'0080 0470 h'0080 0472 h'0080 0474 h'0080 0476 h'0080 0468 h'0080 0444 h'0080 0464 h'0080 0466 h'0080 0478 h'0080 0452 h'0080 0454 h'0080 0456 blank addresses are reserved. dma3 source address register (dm3sa) dma3 destination address register (dm3da) dma3 channel control register (dm3cnt) dma3 transfer count register (dm3tct) dma8 source address register (dm8sa) dma8 destination address register (dm8da) dma8 channel control register (dm8cnt) dma8 transfer count register (dm8tct) dma4 source address register (dm4sa) dma4 destination address register (dm4da) dma4 channel control register (dm4cnt) dma4 transfer count register (dm4tct) dma9 source address register (dm9sa) dma9 destination address register (dm9da) dma9 channel control register (dm9cnt) dma9 transfer count register (dm9tct) dma0 software request generation register (dm0sri) h'0080 0442 h'0080 0446 dma1 software request generation register (dm1sri) dma2 software request generation register (dm2sri) dma3 software request generation register (dm3sri) dma4 software request generation register (dm4sri) dma5 software request generation register (dm5sri) dma6 software request generation register (dm6sri) dma7 software request generation register (dm7sri) dma8 software request generation register (dm8sri) dma9 software request generation register (dm9sri)
9 9-6 ver.0.10 dmac 9.2 dmac related registers 9.2.1 dma channel control register n dma0 channel control register (dm0cnt) d0123456d7 mdsel0 treqf0 reqsl0 tenl0 tszsl0 sadsl0 dadsl0 d bit name function r w 0 mdsel0 0 : normal mode (selects dma0 transfer mode) 1 : ring buffer mode 1 treqf0 0 : not requested (dma0 transfer request flag) 1 : requested 2, 3 reqsl0 00 : software start or one dma2 transfer completed (selects cause of dma0 request) 01 : a-d0 conversion completed 10 : mjt (tio8_udf) 11 : mjt (input event bus 2) 4 tenl0 0 : disables transfer (enables dma0 transfer) 1 : enables transfer 5 tszsl0 0 : 16 bits (selects dma0 transfer size) 1 : 8 bits 6 sadsl0 0 : fixed (selects dma0 source address direction) 1 : incremental 7 dadsl0 0 : fixed (selects dma0 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-7 ver.0.10 dmac 9.2 dmac related registers n dma1 channel control register (dm1cnt) d0123456d7 mdsel1 treqf1 reqsl1 tenl1 tszsl1 sadsl1 dadsl1 d bit name function r w 0 mdsel1 0 : normal mode (selects dma1 transfer mode) 1 : ring buffer mode 1 treqf1 0 : not requested (dma1 transfer request flag) 1 : requested 2, 3 reqsl1 00 : software start (selects cause of dma1 request) 01 : mjt (output event bus 0) 10 : mjt (tin13 input signal) 11 : one dma0 transfer completed 4 tenl1 0 : disables transfer (enables dma1 transfer) 1 : enables transfer 5 tszsl1 0 : 16 bits (selects dma1 transfer size) 1 : 8 bits 6 sadsl1 0 : fixed (selects dma1 source address direction) 1 : incremental 7 dadsl1 0 : fixed (selects dma1 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-8 ver.0.10 dmac 9.2 dmac related registers n dma2 channel control register (dm2cnt) d0123456d7 mdsel2 treqf2 reqsl2 tenl2 tszsl2 sadsl2 dadsl2 d bit name function r w 0 mdsel2 0 : normal mode (selects dma2 transfer mode) 1 : ring buffer mode 1 treqf2 0 : not requested (dma2 transfer request flag) 1 : requested 2, 3 reqsl2 00 : software start (selects cause of dma2 request) 01 : mjt (output event bus 1) 10 : mjt (tin18 input signal) 11 : one dma1 transfer completed 4 tenl2 0 : disables transfer (enables dma2 transfer) 1 : enables transfer 5 tszsl2 0 : 16 bits (selects dma2 transfer size) 1 : 8 bits 6 sadsl2 0 : fixed (selects dma2 source address direction) 1 : incremental 7 dadsl2 0 : fixed (selects dma2 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-9 ver.0.10 dmac 9.2 dmac related registers n dma3 channel control register (dm3cnt) d0123456d7 mdsel3 treqf3 reqsl3 tenl3 tszsl3 sadsl3 dadsl3 d bit name function r w 0 mdsel3 0 : normal mode (selects dma3 transfer mode) 1 : ring buffer mode 1 treqf3 0 : not requested (dma3 transfer request flag) 1 : requested 2, 3 reqsl3 00 : software start (selects cause of dma3 request) 01 : serial i/o0 (transmit buffer empty) 10 : serial i/o1 (reception completed) 11 : mjt (tin0 input signal) 4 tenl3 0 : disables transfer (enables dma3 transfer) 1 : enables transfer 5 tszsl3 0 : 16 bits (selects dma3 transfer size) 1 : 8 bits 6 sadsl3 0 : fixed (selects dma3 source address direction) 1 : incremental 7 dadsl3 0 : fixed (selects dma3 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-10 ver.0.10 dmac 9.2 dmac related registers n dma4 channel control register (dm4cnt) d0123456d7 mdsel4 treqf4 reqsl4 tenl4 tszsl4 sadsl4 dadsl4 d bit name function r w 0 mdsel4 0 : normal mode (selects dma4 transfer mode) 1 : ring buffer mode 1 treqf4 0 : not requested (dma4 transfer request flag) 1 : requested 2, 3 reqsl4 00 : software start (selects cause of dma4 request) 01 : one dma3 transfer completed 10 : serial i/o0 (reception completed) 11 : mjt (tin19 input signal) 4 tenl4 0 : disables transfer (enables dma4 transfer) 1 : enables transfer 5 tszsl4 0 : 16 bits (selects dma4 transfer size) 1 : 8 bits 6 sadsl4 0 : fixed (selects dma4 source address direction) 1 : incremental 7 dadsl4 0 : fixed (selects dma4 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-11 ver.0.10 dmac 9.2 dmac related registers n dma5 channel control register (dm5cnt) d0123456d7 mdsel5 treqf5 reqsl5 tenl5 tszsl5 sadsl5 dadsl5 d bit name function r w 0 mdsel5 0 : normal mode (selects dma5 transfer mode) 1 : ring buffer mode 1 treqf5 0 : not requested (dma5 transfer request flag) 1 : requested 2, 3 reqsl5 00 : software start or one dma7 transfer completed (selects cause of dma5 request) 01 : all dma0 transfers completed 10 : serial i/o2 (reception completed) 11 : mjt (tin20 input signal) 4 tenl5 0 : disables transfer (enables dma5 transfer) 1 : enables transfer 5 tszsl5 0 : 16 bits (selects dma5 transfer size) 1 : 8 bits 6 sadsl5 0 : fixed (selects dma5 source address direction) 1 : incremental 7 dadsl5 0 : fixed (selects dma5 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-12 ver.0.10 dmac 9.2 dmac related registers n dma6 channel control register (dm6cnt) d0123456d7 mdsel6 treqf6 reqsl6 tenl6 tszsl6 sadsl6 dadsl6 d bit name function r w 0 mdsel6 0 : normal mode (selects dma6 transfer mode) 1 : ring buffer mode 1 treqf6 0 : not requested (dma6 transfer request flag) 1 : requested 2, 3 reqsl6 00 : software start (selects cause of dma6 request) 01 : serial i/o1 (transmit buffer empty) 10 : mjt (tin1 input signal) 11 : one dma5 transfer completed 4 tenl6 0 : disables transfer (enables dma6 transfer) 1 : enables transfer 5 tszsl6 0 : 16 bits (selects dma6 transfer size) 1 : 8 bits 6 sadsl6 0 : fixed (selects dma6 source address direction) 1 : incremental 7 dadsl6 0 : fixed (selects dma6 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-13 ver.0.10 dmac 9.2 dmac related registers n dma7 channel control register (dm7cnt) d0123456d7 mdsel7 treqf7 reqsl7 tenl7 tszsl7 sadsl7 dadsl7 d bit name function r w 0 mdsel7 0 : normal mode (selects dma7 transfer mode) 1 : ring buffer mode 1 treqf7 0 : not requested (dma7 transfer request flag) 1 : requested 2, 3 reqsl7 00 : software start (selects cause of dma7 request) 01 : serial i/o2 (transmit buffer empty) 10 : mjt (tin2 input signal) 11 : one dma6 transfer completed 4 tenl7 0 : disables transfer (enables dma7 transfer) 1 : enables transfer 5 tszsl7 0 : 16 bits (selects dma7 transfer size) 1 : 8 bits 6 sadsl7 0 : fixed (selects dma7 source address direction) 1 : incremental 7 dadsl7 0 : fixed (selects dma7 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-14 ver.0.10 dmac 9.2 dmac related registers n dma8 channel control register (dm8cnt) d0123456d7 mdsel8 treqf8 reqsl8 tenl8 tszsl8 sadsl8 dadsl8 d bit name function r w 0 mdsel8 0 : normal mode (selects dma8 transfer mode) 1 : ring buffer mode 1 treqf8 0 : not requested (dma8 transfer request flag) 1 : requested 2, 3 reqsl8 00 : software start (selects cause of dma8 request) 01 : mjt (input event bus 0) 10 : serial i/o3 (reception completed) 11 : mjt (tin7 input signal) 4 tenl8 0 : disables transfer (enables dma8 transfer) 1 : enables transfer 5 tszsl8 0 : 16 bits (selects dma8 transfer size) 1 : 8 bits 6 sadsl8 0 : fixed (selects dma8 source address direction) 1 : incremental 7 dadsl8 0 : fixed (selects dma8 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-15 ver.0.10 dmac 9.2 dmac related registers n dma9 channel control register (dm9cnt) d0123456d7 mdsel9 treqf9 reqsl9 tenl9 tszsl9 sadsl9 dadsl9 d bit name function r w 0 mdsel9 0 : normal mode (selects dma9 transfer mode) 1 : ring buffer mode 1 treqf9 0 : not requested (dma9 transfer request flag) 1 : requested 2, 3 reqsl9 00 : software start (selects cause of dma9 request) 01 : serial i/o3 (transmit buffer empty) 10 : mjt (tin8 input signal) 11 : one dma8 transfer completed 4 tenl9 0 : disables transfer (enables dma9 transfer) 1 : enables transfer 5 tszsl9 0 : 16 bits (selects dma7 transfer size) 1 : 8 bits 6 sadsl9 0 : fixed (selects dma7 source address direction) 1 : incremental 7 dadsl9 0 : fixed (selects dma9 destination 1 : incremental address direction) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
9 9-16 ver.0.10 dmac 9.2 dmac related registers the dma channel control register consists of bits to select dma transfer mode in each channel, set dma transfer request flag, and the bits to select the cause of dma request, enable dma transfer, and set the transfer size and the source/destination address directions. (1) mdseln (dman transfer mode select) bit (d0) this bit when in single transfer mode selects normal mode or ring buffer mode. normal mode is selected by setting this bit to 0 or ring buffer mode is selected by setting it to 1. in ring buffer mode, transfer begins from the transfer start address and after performing transfers 32 times, control is recycled back to the transfer start address, from which transfer operation is repeated. in this case, the transfer count register counts in free-run mode during which time transfer operation is continued until the transfer enable bit is reset to 0 (to disable transfer). no interrupt is generated at completion of dma transfer. (2) treqfn (dman transfer request flag) bit (d1) this flag is set to 1 when a dma transfer request occurs. reading this flag helps to know dma transfer requests in each channel. the generated dma request is cleared by writing a 0 to this bit. if you write a 1, the value you wrote is ignored and the bit retains its previous value. if a new dma transfer request is generated for a channel whose dma transfer request flag has already been set to 1, the next dma transfer request is not accepted until the transfer under way in that channel is completed. (3) reqsln (cause of dman request select) bits (d2, d3) these bits select the cause of dma request in each dma channel. (4) tenln (dman transfer enable) bit (d4) transfer is enabled by setting this bit to 1, so that the channel is ready for dma transfer. conversely, transfer is disabled by setting this bit to 0. however, if a transfer request has already been accepted, transfer in that channel is not disabled until after the requested transfer is completed. (5) tszsln (dman transfer size select) bit (d5) this bit selects the number of bits to be transferred in one dma transfer operation (unit of one transfer). the unit of one transfer is 16 bits when tszsl = 0 or 8 bits when tszsl = 1. (6) sadsln (dman source address direction select) bit (d6) this bit selects the direction in which the source address changes as transfer proceeds. this mode can be selected from two choices: address fixed or address incremental. (7) dadsln (damn destination address direction select) bit (d7) this bit selects the direction in which the destination address changes as transfer proceeds. this mode can be selected from two choices: address fixed or address incremental.
9 9-17 ver.0.10 dmac 9.2 dmac related registers 9.2.2 dma software request generation registers n dma0 software request generation register (dm0sri) n dma1 software request generation register (dm1sri) n dma2 software request generation register (dm2sri) n dma3 software request generation register (dm3sri) n dma4 software request generation register (dm4sri) n dma5 software request generation register (dm5sri) n dma6 software request generation register (dm6sri) n dma7 software request generation register (dm7sri) n dma8 software request generation register (dm8sri) n dma9 software request generation register (dm9sri) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 dm0sri - dm9sri d bit name function r w 0 - 15 dm0sri - dm9sri dma transfer request is generated ? (generates dma software request) by writing any data note: this register can be accessed in either bytes or halfwords. the dma software request generation register is used to generate dma transfer requests in software. a dma transfer request can be generated by writing any data to this register when "software start" has been selected for the cause of dma request. dm0sri - dm9sri (dma software request generate) bit a software dma transfer request is generated by writing any data to this register in halfword (16 bits) or in byte (8 bits) beginning with an even or odd address when "software" is selected as the cause of dma transfer request (by setting the dma channel control register d2, d3 bits to "00").
9 9-18 ver.0.10 dmac 9.2 dmac related registers 9.2.3 dma source address registers n dma0 source address register (dm0sa) n dma1 source address register (dm1sa) n dma2 source address register (dm2sa) n dma3 source address register (dm3sa) n dma4 source address register (dm4sa) n dma5 source address register (dm5sa) n dma6 source address register (dm6sa) n dma7 source address register (dm7sa) n dma8 source address register (dm8sa) n dma9 source address register (dm9sa) d01234567891011121314d15 dm0sa - dm9sa d bit name function r w 0 - 15 dm0sa - dm9sa a16-a31 of the source address (a0-a15 are fixed to h'0080) note: this register must always be accessed in halfwords. the dma source address register is used to set the source address of dma transfer in such a way that d0 corresponds to a16, and d15 corresponds to a31. because this register is comprised of a current register, the value you get by reading this register is always the current value. when dma transfer finishes (at which the transfer count register underflows), the value in this register if "address fixed" is selected, is the same source address that was set in it before dma transfer began; if "address incremental" is selected, the value in this register is the last transfer address + 1 (for 8-bit transfer) or the last transfer address + 2 (for 16-bit transfer). make sure the dma source address register is always accessed in halfwords (16 bits) beginning with an even address. if accessed in bytes, the value read from this register is indeterminate. dm0sa-dm9sa (a16-a31 of the source address) by setting this register, specify the source address of dma transfer in internal i/o space ranging from h'0080 0000 to h'0080 ffff or in the ram space. the 16 high-order bits of the source address (a0-a15) are always fixed to h'0080. use this register to set the 16 low-order bits of the source address (with d0 corresponding to a16, and d15 corresponding to a31).
9 9-19 ver.0.10 dmac 9.2 dmac related registers 9.2.4 dma destination address registers n dma0 destination address register (dm0da) n dma1 destination address register (dm1da) n dma2 destination address register (dm2da) n dma3 destination address register (dm3da) n dma4 destination address register (dm4da) n dma5 destination address register (dm5da) n dma6 destination address register (dm6da) n dma7 destination address register (dm7da) n dma8 destination address register (dm8da) n dma9 destination address register (dm9da) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 dm0da - dm9da d bit name function r w 0 - 15 dm0da - dm9da a16-a31 of the destination address (a0-a15 are fixed to h'0080) note: this register must always be accessed in halfwords. the dma destination address register is used to set the destination address of dma transfer in such a way that d0 corresponds to a16, and d15 corresponds to a31. because access to this register is comprised of a current register, the value you get by reading this register is always the current value. when dma transfer finishes (at which the transfer count register underflows), the value in this register if "address fixed" is selected, is the same destination address that was set in it before dma transfer began; if "address incremental" is selected, the value in this register is the last transfer address + 1 (for 8-bit transfer) or the last transfer address + 2 (for 16-bit transfer). make sure the dma destination address register is always accessed in halfwords (16 bits) beginning with an even address. if accessed in bytes, the value read from this register is indeterminate. dm0da-dm9da (a16-a31 of the destination address) by setting this register, specify the destination address of dma transfer in internal i/o space ranging from h'0080 0000 to h'0080 ffff or in the ram space. the 16 high-order bits of the destination address (a0-a15) are always fixed to h'0080. use this register to set the 16 low-order bits of the destination address (with d0 corresponding to a16, and d15 corresponding to a31).
9 9-20 ver.0.10 dmac 9.2 dmac related registers 9.2.5 dma transfer count registers n dma0 transfer count register (dm0tct) n dma1 transfer count register (dm1tct) n dma2 transfer count register (dm2tct) n dma3 transfer count register (dm3tct) n dma4 transfer count register (dm4tct) n dma5 transfer count register (dm5tct) n dma6 transfer count register (dm6tct) n dma7 transfer count register (dm7tct) n dma8 transfer count register (dm8tct) n dma9 transfer count register (dm9tct) d8 9 1011121314d15 dm0tct - dm9tct d bit name function r w 8 - 15 dm0tct - dm9tct dma transfer count (ignored during 32-channel ring buffer mode) the dma transfer count register is used to set the number of times data is transferred in each channel. however, the value in this register is ignored during ring buffer mode. the transfer count is the (value set in the transfer count register + 1). because the dma transfer count register is comprised of a current register, the value you get by reading this register is always the current value. (however, if you read this register in a cycle immediately after transfer, the value you get is the value that was in the count register before the transfer began.) when transfer finishes, this count register underflows, so that the read value you get is h'ff. if any cascaded channel exists, each time one dma transfer (byte or halfword) is completed or when all transfers are completed (at which the transfer count register underflows), transfer in the cascaded channel starts.
9 9-21 ver.0.10 9.2.6 dma interrupt request status registers n dma0-4 interrupt request status register (dm04itst) d0123456d7 dmitst4 dmitst3 dmitst2 dmitst1 dmitst0 d bit name function r w 0 - 2 no functions assigned 0 3 dmitst4 (dma4 interrupt request status) 0 : no interrupt request 4 dmitst3 (dma3 interrupt request status) 1 : interrupt requested 5 dmitst2 (dma2 interrupt request status) 6 dmitst1 (dma1 interrupt request status) 7 dmitst0 (dma0 interrupt request status) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. the dma0-4 interrupt request status register lets you know the status of interrupt requests in channels 0-4. if the dman interrupt request status bit (n = 0 to 4) is set to 1, it means that a dman interrupt request in the corresponding channel has been generated. dmitstn (dman interrupt request status) bit (n = 0 to 4) [setting the dman interrupt request status bit] this bit can only be set in hardware, and cannot be set in software. [clearing the dman interrupt request status bit] this bit is cleared by writing a 0 in software. note: the dman interrupt request status bit cannot be cleared by writing a 0 to the "interrupt cause bit" of the dma interrupt control register that the interrupt controller has. when writing to the dma0-4 interrupt request status register, be sure to set the bits you want to clear to 0 and all other bits to 1. the bits which are thus set to 1 are unaffected by writing in software, and retain the value they had before you wrote. dmac 9.2 dmac related registers
9 9-22 ver.0.10 dmac 9.2 dmac related registers n dma5-9 interrupt request status register (dm59itst) d0123456d7 dmitst9 dmitst8 dmitst7 dmitst6 dmitst5 d bit name function r w 0 - 2 no functions assigned 0 3 dmitst9 (dma9 interrupt request status) 0 : no interrupt request 4 dmitst8 (dma8 interrupt request status) 1 : interrupt requested 5 dmitst7 (dma7 interrupt request status) 6 dmitst6 (dma6 interrupt request status) 7 dmitst5 (dma5 interrupt request status) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. the dma5-9 interrupt request status register lets you know the status of interrupt requests in channels 5-9. if the dman interrupt request status bit (n = 5 to 9) is set to 1, it means that a dman interrupt request in the corresponding channel has been generated. dmitstn (dman interrupt request status) bit (n = 5 to 9) [setting the dman interrupt request status bit] this bit can only be set in hardware, and cannot be set in software. [clearing the dman interrupt request status bit] this bit is cleared by writing a 0 in software. note: the dman interrupt request status bit cannot be cleared by writing a 0 to the "interrupt cause bit" of the dma interrupt control register that the interrupt controller has. when writing to the dma5-9 interrupt request status register, be sure to set the bits you want to clear to 0 and all other bits to 1. the bits which are thus set to 1 are unaffected by writing in software, and retain the value they had before you wrote.
9 9-23 ver.0.10 dmac 9.2 dmac related registers 9.2.7 dma interrupt mask registers n dma0-4 interrupt mask register (dm04itmk) d8 9 1011121314d15 dmitmk4 dmitmk3 dmitmk2 dmitmk1 dmitmk0 d bit name function r w 8 - 10 no functions assigned 0 11 dmitmk4 (dma4 interrupt request mask) 0 : enables interrupt request 12 dmitmk3 (dma3 interrupt request mask) 1 : masks (disables) interrupt request 13 dmitmk2 (dma2 interrupt request mask) 14 dmitmk1 (dma1 interrupt request mask) 15 dmitmk0 (dma0 interrupt request mask) the dma0-4 interrupt mask register is used to mask interrupt requests in dma channels 0-4. dmitmkn (dman interrupt request mask) bit (n = 0 to 4) dman interrupt request is masked by setting the dman interrupt request mask bit to 1. however, when an interrupt request is generated, the dman interrupt request status bit is always set to 1 irrespective of the contents of this register.
9 9-24 ver.0.10 dmac 9.2 dmac related registers n dma5-9 interrupt mask register (dm59itmk) d8 9 1011121314d15 dmitmk9 dmitmk8 dmitmk7 dmitmk6 dmitmk5 d bit name function r w 8 - 10 no functions assigned 0 11 dmitmk9 (dma9 interrupt request mask) 0 : enables interrupt request 12 dmitmk8 (dma8 interrupt request mask) 1 : masks (disables) interrupt request 13 dmitmk7 (dma7 interrupt request mask) 14 dmitmk6 (dma6 interrupt request mask) 15 dmitmk5 (dma5 interrupt request mask) the dma5-9 interrupt mask register is used to mask interrupt requests in dma channels 5-9. dmitmkn (dman interrupt request mask) bit (n = 5 to 9) dman interrupt request is masked by setting the dman interrupt request mask bit to 1. however, when an interrupt request is generated, the dman interrupt request status bit is always set to 1 irrespective of the contents of this register.
9 9-25 ver.0.10 dmac 9.2 dmac related registers figure 9.2.3 block diagram of dma transfer interrupt 0 b3 dmitst4 f/f dmitmk4 f/f b11 b4 dmitst3 f/f dmitmk3 f/f b12 b5 dmitst2 f/f dmitmk2 f/f b13 b6 dmitst1 f/f dmitmk1 f/f b14 b7 dmitst0 f/f dmitmk0 f/f b15 dm04itst dm04itmk dma4udf dma3udf dma2udf dma1udf dma0udf data bus dma transfer interrupt 0 (level) 5-source inputs
9 9-26 ver.0.10 dmac 9.2 dmac related registers figure 9.2.4 block diagram of dma transfer interrupt 1 b3 dmitst9 f/f dmitmk9 f/f b11 b4 dmitst8 f/f dmitmk8 f/f b12 b5 dmitst7 f/f dmitmk7 f/f b13 b6 dmitst6 f/f dmitmk6 f/f b14 b7 dmitst5 f/f dmitmk5 f/f b15 dm59itst dm59itmk dma9udf dma8udf dma7udf dma6udf dma5udf data bus dma transfer interrupt 1 (level) 5-source inputs
9 9-27 ver.0.10 dmac 9.3 functional description of the dmac 9.3 functional description of the dmac 9.3.1 cause of dma request for each dma channel (channels 0 to 9), dma transfer can be requested from multiple sources. there are various causes (or sources) of dma transfer, so that dma transfer can be started by a request from internal peripheral i/o, started in software by a program, or can be started upon completion of one transfer or all transfers in a dma channel (cascade mode). the cause of dma request is selected using the cause of request select bit provided for each channel, reqsln (dman channel control register bits d2, d3). the table below lists the causes of dma requests in each channel. table 9.3.1 causes of dma requests in dma0 and generation timings reqsl0 cause of dma request dma request generation timing 0 0 software start when any data is written to dma0 software request or one dma2 transfer completed generation register (software start) or one dma2 transfer is completed (cascade mode) 0 1 a-d0 conversion completed when a-d0 conversion is completed 1 0 mjt (tio8_udf) when mjt tio8 underflow occurs 1 1 mjt (input event bus 2) when mjt's input event bus 2 signal is generated table 9.3.2 causes of dma requests in dma1 and generation timings reqsl1 cause of dma request dma request generation timing 0 0 software start when any data is written to dma1 software request generation register 0 1 mjt (output event bus 0) when mjt's output event bus 0 signal is generated 1 0 mjt (tin13 input signal) when mjt's tin13 input signal is generated 1 1 one dma0 transfer completed when one dma0 transfer is completed (cascade mode)
9 9-28 ver.0.10 dmac 9.3 functional description of the dmac table 9.3.3 causes of dma requests in dma2 and generation timings reqsl2 cause of dma request dma request generation timing 0 0 software start when any data is written to dma2 software request generation register 0 1 mjt (output event bus 1) when mjt's output event bus 1 signal is generated 1 0 mjt (tin18 input signal) when mjt's tin18 input signal is generated 1 1 one dma1 transfer completed when one dma1 transfer is completed (cascade mode) table 9.3.4 causes of dma requests in dma3 and generation timings reqsl3 cause of dma request dma request generation timing 0 0 software start when any data is written to dma3 software request generation register 0 1 serial i/o0 (transmit buffer empty) when serial i/o0 transmit buffer is emptied 1 0 serial i/o1 (reception completed) when serial i/o1 reception is completed 1 1 mjt (tin0 input signal) when mjt's tin0 input signal is generated table 9.3.5 causes of dma requests in dma4 and generation timings reqsl4 cause of dma request dma request generation timing 0 0 software start when any data is written to dma4 software request generation register 0 1 one dma3 transfer completed when one dma3 transfer is completed (cascade mode) 1 0 serial i/o0 (reception completed) when serial i/o0 reception is completed 1 1 mjt (tin19 input signal) when mjt's tin19 input signal is generated
9 9-29 ver.0.10 dmac 9.3 functional description of the dmac table 9.3.6 causes of dma requests in dma5 and generation timings reqsl5 cause of dma request dma request generation timing 0 0 software start when any data is written to dma5 software request or one dma7 transfer completed generation register or one dma7 transfer is completed (cascade mode) 0 1 all dma0 transfers completed when all dma0 transfers are completed (cascade mode) 1 0 serial i/o2 (reception completed) when serial i/o2 reception is completed 1 1 mjt (tin20 input signal) when mjt's tin20 input signal is generated table 9.3.7 causes of dma requests in dma6 and generation timings reqsl6 cause of dma request dma request generation timing 0 0 software start when any data is written to dma6 software request generation register 0 1 serial i/o1 (transmit buffer empty) when serial i/o1 transmit buffer is emptied 1 0 mjt (tin1 input signal) when mjt's tin1 input signal is generated 1 1 one dma5 transfer completed when one dma5 transfer is completed (cascade mode) table 9.3.8 causes of dma requests in dma7 and generation timings reqsl7 cause of dma request dma request generation timing 0 0 software start when any data is written to dma7 software request generation register 0 1 serial i/o2 (transmit buffer empty) when serial i/o2 transmit buffer is emptied 1 0 mjt (tin2 input signal) when mjt's tin2 input signal is generated 1 1 one dma6 transfer completed when one dma6 transfer is completed (cascade mode)
9 9-30 ver.0.10 dmac 9.3 functional description of the dmac table 9.3.9 causes of dma requests in dma8 and generation timings reqsl8 cause of dma request dma request generation timing 0 0 software start when any data is written to dma8 software request generation register 0 1 mjt (input event bus 0) when mjt's input event bus 0 signal is generated 1 0 serial i/o3 (reception completed) when serial i/o3 reception is completed 1 1 mjt (tin7 input signal) when mjt's tin7 input signal is generated table 9.3.10 causes of dma requests in dma9 and generation timings reqsl9 cause of dma request dma request generation timing 0 0 software start when any data is written to dma9 software request generation register 0 1 serial i/o3 (transmit buffer empty) when serial i/o3 transmit buffer is emptied 1 0 mjt (tin8 input signal) when mjt's tin8 input signal is generated 1 1 one dma8 transfer completed when one dma8 transfer is completed (cascade mode)
9 9-31 ver.0.10 dmac 9.3 functional description of the dmac 9.3.2 dma transfer processing procedure shown below is an example of how to control dma transfer in cases when performing transfer in dma channel 0. figure 9.3.1 example of a dma transfer processing procedure dma transfer starts as requested by internal peripheral i/o dma transfer processing starts transfer count register underflows interrupt request generated set dma0 channel control register set dma0-4 interrupt request status register set dma0 channel control register set dma0 source address register set dma0 destination address register set dma0 count register setting dmac related registers starting dma transfer dma transfer completed ?transfers disabled ?clears interrupt request status bit set dma0-4 interrupt mask register ?source address of transfer ?address ?number of times dma transfer performed ?transfer mode, cause of request, transfer size, address direction, and transfer enable dma operation completed ?enables interrupt request set the interrupt controller's dma0-4 interrupt control register ?interrupt priority level setting interrupt controller related registers
9 9-32 ver.0.10 dmac 9.3 functional description of the dmac figure 9.3.2 gaining and releasing control of the internal bus 9.3.3 starting dma use the reqsl (cause of dma request select) bit to set the cause of dma request. to enable dma, set the tenl (dma transfer enable) bit to 1. dma transfer begins when the specified cause of dma request becomes effective after setting the tenl (dma transfer enable) bit to 1. 9.3.4 channel priority channel 0 has the highest priority. the priority of this and other channels is shown below. channel 0 > channel 1 > channel 2 > channel 3 > channel 4 > channel 5 > channel 6 > channel 7 > channel 8 > channel 9 this order of priority is fixed and cannot be changed. among channels for which dma transfers are requested, the channel that has the highest priority is selected. channel selection is made every transfer cycle (one dma bus cycle consisting of three machine cycles). 9.3.5 gaining and releasing control of the internal bus for any channel, control of the internal bus is gained and released in "single transfer dma" mode. in single transfer dma, the dma gains control of the internal bus when dma transfer request is accepted and after executing one dma transfer (consisting of one read cycle + one write cycle of internal peripheral clock), returns bus control to the cpu. the diagram below shows dma operation in single transfer dma. one dma transfer dmac cpu internal bus arbitration (control requested by dmac) internal bus r: read w: write rw rw rw requested gained released requested gained requested gained released released one dma transfer one dma transfer
9 9-33 ver.0.10 dmac 9.3 functional description of the dmac 9.3.6 transfer units use the tszsl (dma transfer size select) bit to set for each channel the number of bits (8 or 16 bits) to be transferred in one dma transfer. 9.3.7 transfer counts use the dma transfer count register to set transfer counts for each channel. transfer can be performed up to 256 times. the value of the dma transfer count register is decremented by one each time one transfer unit is transferred. in ring buffer mode, the dma transfer count register operates in free-run mode, with the value set in it ignored. 9.3.8 address space the address space in which data can be transferred by dma is the internal peripheral i/o or 64 kbytes of ram space (h'0080 0000 through h'0080 ffff) for either source or destination. to set the source and destination addresses in each channel, use the dma source address register and dma destination address register. 9.3.9 transfer operation (1) dual-address transfer irrespective of the size of transfer unit, data is transferred in two bus cycles, one for source read access and one for destination write access. (the transfer data is temporarily taken into the dma's internal temporary register.) (2) bus protocol and bus timing because the bus interface is shared with the cpu, the same applies to both bus protocol and bus timing as in peripheral module access from the cpu. (3) transfer rate the maximum transfer rate is calculated using the equation below: 1 maximum transfer rate [bytes/second] = 2 bytes 1 / f (bclk) 3 cycles
9 9-34 ver.0.10 dmac 9.3 functional description of the dmac (4) address count direction and address changes the direction in which the source and destination addresses are counted as transfer proceeds ("address fixed" or "address incremental") is set for each channel using the sadsl (source address direction select) and dadsl (destination address select) bits. when the transfer size is 16 bits, the address is incremented by two for each dma transfer performed; when the transfer size is 8 bits, the address is incremented by one. table 9.3.11 address count direction and address changes address count direction transfer unit address change for one dma address fixed 8 bits 0 16 bits 0 address incremental 8 bits +1 16 bits +2 (5) transfer count value the transfer count value is decremented by one at a time irrespective of the size of transfer unit (8 or 16 bits).
9 9-35 ver.0.10 dmac 9.3 functional description of the dmac (6) transfer byte positions when the transfer unit = 8 bits, the lsb of the address register is effective for both source and destination. (therefore, in addition to data transfers between even addresses or between odd addresses, data may be transferred from even address to odd address, or from odd address to even address.) when the transfer unit = 8 bits, the lsb of the address register (d15 of the address register) is ignored, and data are always transferred in two bytes aligned to the 16-bit bus. the diagram below shows the valid transfer byte positions. figure 9.3.3 transfer byte positions d0 d7 d8 d15 8 bits + 0 + 1 source destination 16 bits d0 d7 d8 d15 + 0 + 1 8 bits 8 bits 8 bits 16 bits
9 9-36 ver.0.10 dmac 9.3 functional description of the dmac figure 9.3.4 example of address increment operation in 32-channel ring buffer mode (7) ring buffer mode when ring buffer mode is selected, transfer begins from the transfer start address and after performing transfers 32 times, control is recycled back to the transfer start address, from which transfer operation is repeated. in this case, however, the five low-order bits of the ring buffer start address must always be b'00000. the address increment operation in ring buffer mode is described below. when the transfer unit = 8 bits the 27 high-order bits of the transfer start address are fixed, and the five low-order bits are incremented by one at a time. when as transfer proceeds the five low-order bits reach b'11111, they are recycled to b'00000 by the next increment operation, thus returning to the start address again. when the transfer unit = 16 bits the 26 high-order bits of the transfer start address are fixed, and the six low-order bits are incremented by two at a time. when as transfer proceeds the six low-order bits reach b'111110, they are recycled to b'000000 by the next increment operation, thus returning to the start address again. when the source address has been set to be incremented, it is the source address that recycles to the start address; when the destination address has been set to be incremented, it is the destination address that recycles to the start address. if both source and destination addresses have been set to be incremented, both addresses recycle to the start address. however, the start address on either side must have their five low-order bits initially being b'00000. during ring buffer mode, the transfer count register is ignored. also, once dma operation starts, the counter operates in free-run mode, and the transfer continues until the transfer enable bit is cleared to (to disable transfer). transfer count transfer address 1 h'0080 1000 2 h'0080 1001 3 h'0080 1002 || 31 h'0080 101e 32 h'0080 101f 1 h'0080 1000 2 h'0080 1001 || transfer count transfer address 1 h'0080 1000 2 h'0080 1002 3 h'0080 1004 || 31 h'0080 103c 32 h'0080 103e 1 h'0080 1000 2 h'0080 1002 ||
9 9-37 ver.0.10 dmac 9.3 functional description of the dmac 9.3.10 end of dma and interrupt in normal mode, dma transfer is terminated when the transfer count register underflows. when transfer finishes, the transfer enable bit is cleared to 0 and transfers are thereby disabled. also, an interrupt request is generated at completion of transfer. however, this interrupt is not generated for channels where interrupt requests have been masked by the dma interrupt mask register. during ring buffer mode, the transfer count register operates in free-run mode, and transfer continues until the transfer enable bit is cleared to 0 (to disable transfer). in this case, therefore, the dma transfer-completed interrupt request is not generated. nor is this interrupt request generated even when transfer in ring buffer mode is terminated by clearing the transfer enable bit. 9.3.11 status of each register after completion of dma transfer when dma transfer is completed, the status of the source address and destination address registers becomes as follows: (1) address fixed ? the value set in the address register before dma transfer started remains intact (fixed). (2) address incremental ? for 8-bit transfer, the value of the address register is the last transfer address + 1. ? for 16-bit transfer, the value of the address register is the last transfer address + 2. the transfer count register when dma transfer completed is in an underflow state (h'ff). therefore, to perform another dma transfer, set the transfer count register newly again, except when you are performing transfers 256 times (h'ff).
9 9-38 ver.0.10 dmac 9.4 precautions about the dmac 9.4 precautions about the dmac ? about writing to dmac related registers because dma transfer involves exchanging data via the internal bus, basically you only can write to the dmac related registers immediately after reset or when transfer is disabled (transfer enable bit = 0). when transfer is enabled, do not write to the dmac related registers because write operation to those registers, except the dma transfer enable bit, transfer request flag, and the dma transfer count register which is protected in hardware, is instable. the table below shows the registers that can or cannot be accessed for write. table 9.4.1 dmac related registers that can or cannot be accessed for write status transfer enable bit transfer request flag other dmac related registers when transfer is enabled 5 when transfer is disabled : can be accessed ; 5 : cannot be accessed for even registers that can exceptionally be written to while transfer is enabled, the following requirements must be met. dma channel control register's transfer enable bit and transfer request flag for all other bits of the channel control register, be sure to write the same data that those bits had before you wrote to the transfer enable bit or transfer request flag. note that you only can write a 0 to the transfer request flag as valid data. dma transfer count register when transfer is enabled, this register is protected in hardware, so that any data you write to this register is ignored. a rewriting the dma source and dma destination addresses on different channels by dma transfer in this case, you are writing to the dmac related registers while dma is enabled, but this practically does not present any problem. however, you cannot dma-transfer to the dmac related registers on the local channel itself in which you are currently operating.
9 9-39 ver.0.10 dmac 9.4 precautions about the dmac 9.4 precautions about the dmac ? manipulating dmac related registers by dma transfer when manipulating dmac related registers by means of dma transfer (e.g., reloading the dmac related registers' initial values by dma transfer), do not write to the dmac related registers on the local channel itself through that channel. (if this precaution is neglected, device operation cannot be guaranteed.) only if residing on other channels, you can write to the dmac related registers by means of dma transfer. (for example, you can rewrite the dman source address and dman destination address registers on channel 1 by dma transfer through channel 0.) ? about the dma interrupt request status register when clearing the dma interrupt request status register, be sure to write 1s to all bits but the one you want to clear. the bits to which you wrote 1s retain the previous data they had before the write. ? about the stable operation of dma transfer to ensure the stable operation of dma transfer, never rewrite the dmac related registers, except the dma channel control register's transfer enable bit, unless transfer is disabled. one exception is that even when transfer is enabled, you can rewrite the dma source address and dma destination address registers by dma transfer from one channel to another.
9 9-40 ver.0.10 dmac 9.4 precautions about the dmac * this is a blank page.*
chapter 10 chapter 10 multijunction timers 10.1 outline of multijunction timers 10.2 common units of multijunction timer 10.3 top (output-related 16-bit timer) 10.4 tio (input/output-related 16-bit timer) 10.5 tms (input-related 16-bit timer) 10.6 tml (input-related 32-bit timer) 10.7 tid (input-related 16-bit timer) 10.8 tod (output-related 16-bit timer) 10.9 tom (output-related 16-bit timer)
10 10-2 ver.0.10 10.1 outline of multijunction timers the multijunction timers (abbreviated mjt) have input event and output event buses. therefore, in addition to being used as a single unit, the timers can be internally connected to each other. this capability allows for highly flexible timer configuration, making it possible to meet various application needs. it is because the timers are connected to the internal event bus at multiple points that they are called the "multijunction" timers. the 32170 has seven types of multijunction timers as listed in the table below, providing a total of 64 channels of timers. table 10.1.1 outline of multijunction timers (1/2) name type number of channels description top output-related 11 one of three output modes can be selected by software. (timer output) 16-bit timer (down-counter) ? single-shot output mode ? delayed single-shot output mode ? continuous output mode tio input/output-related 10 one of three input modes or four output modes can be (timer 16-bit timer selected by software. input output) (down-counter) ? measure clear input mode ? measure free-run input mode ? noise processing input mode ? pwm output mode ? single-shot output mode ? delayed single-shot output mode ? continuous output mode tms input-related 8 16-bit input measure timer (timer 16-bit timer measure small) (up-counter) tml input-related 8 32-bit input measure timer (timer 32-bit timer measure large) (up-counter) multijunction timers 10.1 outline of multijunction timers
10 10-3 ver.0.10 multijunction timers 10.1 outline of multijunction timers table 10.1.1 outline of multijunction timers (2/2) name type number of channels description tid input-related 3 one of three input modes can be selected by software. (timer input 16-bit timer ? fixed period mode derivation) (up/down-counter) ? event count mode ? multiply-by-4 event count mode tod output-related 16 one of four output modes can be selected by software. (timer output 16-bit timer derivation) (down-counter) ? pwm output mode ? single-shot output mode ? delayed single-shot output mode ? continuous output mode tom output-related 8 one of four output modes can be selected by software. (timer output 16-bit timer modification) (down-counter) ? pwm output mode ? single-shot pwm output mode ? single-shot output mode ? continuous output mode table 10.1.2 mjt interrupt generation functions of the m32170 signal name source of mjt interrupt requested interrupt controller (icu) input icu cause input irq18 tin30 - tin33 input tml1 input interrupt 4 irq17 tid2 output tid2 output interrupt 1 irq16 tod1_0 - tod1_7 output tod1+tom0 output interrupt 16 tom0_0 - tom0_7 output irq15 tid1 output tid1 output interrupt 1 irq14 tid0 output tid0 output interrupt 1 irq13 tod0_0 - tod0_7 output tod0 output interrupt 8 irq12 tin3 - tin6 input mjt input interrupt 4 4 irq11 tin20 - tin23 input mjt input interrupt 3 4 irq10 tin12 - tin19 input mjt input interrupt 2 8 irq9 tin0 - tin2 input mjt input interrupt 1 3 irq8 tin7 - tin11 input mjt input interrupt 0 5 irq7 tms0, tms1 output mjt output interrupt 7 2 irq6 top8, top9 output mjt output interrupt 6 2 irq5 top10 output mjt output interrupt 5 1 irq4 tio4 - 7 output mjt output interrupt 4 4 irq3 tio8, tio9 output mjt output interrupt 3 2 irq2 top0 - 5 output mjt output interrupt 2 6 irq1 top6, top7 output mjt output interrupt 1 2 irq0 tio0 - 3 output mjt output interrupt 0 4
10 10-4 ver.0.10 table 10.1.3 dma transfer request generation by mjt signal name source of dma request generated dmac input channel drq0 tio8 underflow channel 0 drq1 input event bus 2 channel 0 drq2 output event bus 0 channel 1 drq3 tin13 input channel 1 drq4 output event bus 1 channel 2 drq5 tin18 input channel 2 drq6 tin19 input channel 4 drq7 tin0 input channel 3 drq8 tin1 input channel 6 drq9 tin2 input channel 7 drq10 tin7 input channel 8 drq11 tin8 input channel 9 drq12 tin20 input channel 5 drq13 input event bus 0 channel 8 table 10.1.4 a-d conversion start request by mjt signal name source of a-d conversion start requested a-d converter ad0trg output event bus 3 can be input to a-d0 conversion start trigger ad1trg tid1 overflow/underflow can be input to a-d1 conversion start trigger multijunction timers 10.1 outline of multijunction timers
10 10-5 ver.0.10 multijunction timers 10.1 outline of multijunction timers figure 10.1.1 block diagram of mjt (1/4) note 1: irq0-18 denote interrupt signals, of which the same number indicates the same group of interrupts. (see table 10.1.2.) drq0-13 denote dma request signals fed to the dmac. (see table 10.1.3.) ad0trg and ad1trg denote trigger signals to a-d0 and a-d1 converters, respectively. note 2: indicates timer input pin edge selection output. note 3: indicates input signals from peripheral circuits (ad and sio). irq2 irq12 irq12 irq12 clk en udf top 0 clock bus input event bus clk en udf top 1 clk en udf top 2 clk en udf top 3 output event bus tclk0s to 0 irq9 1/2 internal peripheral clock irq8 clk en udf top 4 clk en udf top 5 tclk0 tin0 tin7 tclk1 s s tin0s clk en udf top 6 clk en udf top 7 s s s irq9 tin1 irq9 tin2 s s clk en udf top 8 clk en udf top 9 clk en udf top 10 clk en/cap udf tio 0 clk en/cap udf tio 1 clk en/cap udf tio 2 clk en/cap udf tio 3 clk en/cap udf tio 4 s s tin3 s s tin4 tin5 s s irq12 tin6 psc1 psc0 clk en/cap udf tio 5 s s irq8 tin8 tclk2 clk en/cap udf tio 6 s s irq8 tin9 clk en/cap udf tio 7 s s irq8 tin10 s s clk en/cap udf tio 8 clk en/cap udf tio 9 irq8 tin11 s s f/f0 f/f1 f/f2 f/f3 f/f4 f/f5 f/f6 f/f7 f/f8 f/f9 f/f10 f/f11 f/f12 f/f13 f/f14 f/f15 s f/f16 f/f17 f/f18 f/f19 f/f20 s : selector f/f : output flip-flop psc0 - 5 : prescaler s s s s s s s s s s s s s s irq2 irq2 irq2 irq2 irq2 to 1 to 2 to 3 to 4 to 5 to 6 to 7 to 8 to 9 to 10 to 11 to 12 to 13 to 14 to 15 irq1 irq1 irq6 irq6 irq5 irq0 irq0 irq0 irq0 irq4 to 16 to 17 to 18 to 19 to 20 irq4 drq0 irq3 irq3 psc2 irq4 irq4 tin1s tin2s tin3s tin4s tin5s tin6s tclk1s tclk2s tin7s tin8s tin9s tin10s tin11s drq7 drq8 drq9 drq10 drq11 ad0trg (to a-d0 converter) 3210 3210 (note 1) 3210 3210 0123 0123
10 10-6 ver.0.10 multijunction timers 10.1 outline of multijunction timers figure 10.1.2 block diagram of mjt (2/4) clk tms 0 s ovf cap3 cap2 cap1 cap0 s s s s tclk3 tclk3s drq3 irq10 tin12 tin13 tin14 tin15 clk tms 1 ovf cap3 cap2 cap1 cap0 s s s s s drq5 tin16 tin17 tin18 tin19 drq6 irq10 irq10 irq10 irq10 irq10 irq10 irq10 clk tml0 cap3 cap2 cap1 cap0 s s s s tin20 tin21 tin22 tin23 irq11 irq11 irq11 irq11 irq7 irq7 tin12s tin13s tin14s tin15s tin16s tin17s tin18s tin19s tin20s tin21s tin22s tin23s s drq12 clk tml1 cap3 cap2 cap1 cap0 s s s s tin30 tin31 tin32 tin33 tin30s tin31s tin32s tin33s s irq18 irq18 irq18 irq18 s : selector 3210 3210 0123 clock bus input event bus output event bus 3210 3210 0123 1/2 internal peripheral clock 1/2 internal peripheral clock
10 10-7 ver.0.10 figure 10.1.3 block diagram of mjt (3/4) multijunction timers 10.1 outline of multijunction timers clk tid0 ovf udf tin24 tin25 irq14 clk tod0_0 udf f/f21 clk tod0_1 udf f/f22 to21 to22 clk tod0_2 udf f/f23 clk tod0_3 udf f/f24 to23 to24 clk tod0_4 udf f/f25 clk tod0_5 udf f/f26 to25 to26 clk tod0_6 udf f/f27 clk tod0_7 udf f/f28 to27 to28 irq13 irq13 irq13 irq13 irq13 irq13 irq13 irq13 clk1 clk2 psc3 clk tid1 tin26 tin27 irq15 clk tod1_0 udf f/f29 clk tod1_1 udf f/f30 to29 to30 clk tod1_2 udf f/f31 clk tod1_3 udf f/f32 to31 to32 clk tod1_4 udf f/f33 clk tod1_5 udf f/f34 to33 to34 clk tod1_6 udf f/f35 clk tod1_7 udf f/f36 to35 to36 irq16 irq16 irq16 irq16 irq16 irq16 irq16 irq16 clk1 clk2 psc4 clk tid2 tin28 tin29 clk tom0_0 udf f/f37 clk tom0_1 udf f/f38 to37 to38 clk tom0_2 udf f/f39 clk tom0_3 udf f/f40 to39 to40 clk tom0_4 udf f/f41 clk tom0_5 udf f/f42 to41 to42 clk tom0_6 udf f/f43 clk tom0_7 udf f/f44 to43 to44 irq16 irq16 irq16 irq16 irq16 irq16 irq16 irq16 clk1 clk2 psc5 ovf udf ovf udf (note) irq17 en clock bus input event bus output event bus 3210 3210 0123 1/2 internal peripheral clock 1/2 internal peripheral clock 1/2 internal peripheral clock 3210 3210 s : selector 0123 ad1trg (to a-d1 converter) en en en en en en en en en en en en en en en
10 10-8 ver.0.10 multijunction timers 10.1 outline of multijunction timers figure 10.1.4 block diagram of mjt (4/4) ad0 completed tio8-udf s dma0 udf end dmairq0 s dmairq0 tin13 tin18 s dmairq0 s dmairq0 tin19 sio0-txd sio1-rxd sio0-rxd s dmairq1 dmairq1 sio2-rxd sio1-txd dmairq1 dmairq1 sio2-txd sio3-rxd dmairq1 sio3-txd tin2 tin7 tin8 tin20 tin1 tin0 s dmairq0 s s s s clock bus input event bus output event bus 3210 3210 3210 0123 0123 (note 2) (note 2) (note 2) (note 2) (note 2) (note 2) (note 2) (note 2) (note 2) dma1 udf end dma2 udf end dma3 udf end dma4 udf (note 3) (note 3) (note 3) (note 3) (note 3) (note 3) (note 3) (note 3) dma5 udf end dma7 udf end dma6 udf end (note 3) (note 3) dma8 udf end dma9 udf 3210
10 10-9 ver.0.10 multijunction timers 10.2 common units of multijunction timer 10.2 common units of multijunction timer the common units of the multijunction timer include the following: ? prescaler unit ? clock bus/input-output event bus control unit ? input processing control unit ? output flip-flop control unit ? interrupt control unit 10.2.1 timer common register map the diagrams in the next pages show a map of registers in the common units of the multijunction timer.
10 10-10 ver.0.10 multijunction timers 10.2 common units of multijunction timer figure 10.2.1 timer common register map (1/2) address d0 d7 +0 address +1 address d8 d15 note: the registers included in thick frames must always be accessed in halfwords. h'0080 0200 h'0080 0214 h'0080 0216 h'0080 0218 h'0080 0210 h'0080 0212 h'0080 0224 h'0080 0226 h'0080 0228 h'0080 022a h'0080 0222 h'0080 0236 h'0080 0238 h'0080 023a h'0080 023c h'0080 023e h'0080 0234 h'0080 0204 h'0080 0230 h'0080 0232 h'0080 07d0 h'0080 021a h'0080 0220 blank addresses are reserved. tin input processing control register 0 (tincr0) tin input processing control register 1 (tincr1) clock bus & input event bus control register (ckiebcr) prescaler register 2 (prs2) output event bus control register (oebcr) tin input processing control register 4 (tincr4) f/f protect register 0 (ffp0) f/f data register 0 (ffd0) f/f source select register 1 (ffs1) f/f data register 1 (ffd1) tio interrupt control register 0 (tioir0) tio interrupt control register 1 (tioir1) tod0 control register (tod0cr) prescaler register 0 (prs0) prescaler register 1 (prs1) tclk input processing control register (tclkcr) h'0080 0202 tin input processing control register 2 (tincr2) tin input processing control register 3 (tincr3) f/f source select register 0 (ffs0) f/f protect register 1 (ffp1) top interrupt control register 2 (topir2) top interrupt control register 3 (topir3) top interrupt control register 0 (topir0) top interrupt control register 1 (topir1) tio interrupt control register 2 (tioir2) tms interrupt control register (tmsir) tin interrupt control register 0 (tinir0) tin interrupt control register 1 (tinir1) tin interrupt control register 2 (tinir2) tin interrupt control register 3 (tinir3) tin interrupt control register 4 (tinir4) tin interrupt control register 5 (tinir5) tin interrupt control register 6 (tinir6) tin interrupt control register 7 (tinir7) prescaler register 3 (prs3) tid0 control & prescaler 3 enable register (tid0prs3en) h'0080 07d2 tod0 interrupt mask register (tod0ima) tod0 interrupt status register (tod0ist) h'0080 07d4 f/f protect register 2 (ffp2) h'0080 07d6 f/f data register 2 (ffd2) h'0080 07d8 h'0080 07da h'0080 07dc tod0 enable protect register (tod0pro) h'0080 07de tod0 count enable register (tod0cen) tin input processing control register 3 (tincr3)
10 10-11 ver.0.10 multijunction timers 10.2 common units of multijunction timer address d0 d7 +0 address +1 address d8 d15 note: the re g isters included in thick frames must always be accessed in halfwords. h'0080 0bd0 blank addresses are reserved. prescaler register 4 (prs4) tid1 control & prescaler 4 enable register (tid1prs4en) h'0080 0bd2 tod1 interrupt mask register (tod1ima) tod1 interrupt status register (tod1ist) h'0080 0bd4 f/f protect register 3 (ffp3) h'0080 0bd6 f/f data register 3 (ffd3) h'0080 0cd0 prescaler register 5 (prs5) tid2 control & prescaler 5 enable register (tid2prs5en) h'0080 0cd2 tom0 interrupt mask register (tom0ima) tom0 interrupt status register (tom0ist) h'0080 0cd4 f/f protect register 4 (ffp4) h'0080 0cd6 f/f data register 4 (ffd4) figure 10.2.2 timer common register map (2/2)
10 10-12 ver.0.10 multijunction timers 10.2 common units of multijunction timer 10.2.2 prescaler unit the prescalers prs0-5 are an 8-bit counter, which generates clocks supplied to each timer (top, tio, tms, tml, tid, tod, and tom) from the divide-by-2 frequency of the internal peripheral clock (10.0 mhz when the internal peripheral clock = 20 mhz). the values of prescaler registers are initialized to h'00 when reset. also, when you rewrite the set value of any prescaler register, the device starts operating with the new value simultaneously when the prescaler underflows. values h'00 to h'ff can be set in the counter registers of prescalers. the prescalers' divide-by ratios are given by the equation below. 1 prescaler divide-by ratio = prescaler set value + 1 n prescaler register 0 (prs0) n prescaler register 1 (prs1) n prescaler register 2 (prs2) n prescaler register 3 (prs3) n prescaler register 4 (prs4) n prescaler register 5 (prs5) d0123456d7 ( d8 9 10 11 12 13 14 d15 ) prs0 - prs5 d bit name function r w 0 - 7 prs0, 2 - 5 sets the prescaler's divide-by value 8 - 15 prs1 prescaler registers 0-2 start counting after reset removal. prescaler registers 3-5 each are activated by setting the tid0 control & prescaler 3 enable register, tid1 control & prescaler 4 enable register, and tid2 control & prescaler 5 enable register to 1 (= count start), upon which they reload the prescaler register value and start counting. for details, refer to section 10.7, "tid (input-related 16-bit timer)."
10 10-13 ver.0.10 multijunction timers 10.2 common units of multijunction timer 10.2.3 clock bus/input-output event bus control unit (1) clock bus the clock bus is provided for supplying clock to each timer, and is comprised of four lines of clock bus 0-3. each timer can use this clock bus signal as clock input signal. the table below lists the signals that can be fed to the clock bus. table 10.2.1 signals that can be fed to each clock bus line clock bus acceptable signal 3 tclk0 input 2 internal prescaler (psc2) or tclk3 input 1 internal prescaler (psc1) 0 internal prescaler (psc0) (2) input event bus the input event bus is provided for supplying a count enable signal or measure capture signal to each timer, and is comprised of four lines of input event bus 0-3. each timer can use this input event bus signal as enable (or capture) signal input. the table below lists the signals that can be fed to the input event bus. table 10.2.2 signals that can be fed to each input event bus line input event bus acceptable signal 3 tin3 input, output event bus 2 or tio7 underflow signal 2 tin0 input, tin2 input or tin4 input 1 tin5 input or tio6 underflow signal 0 tin6 input or tio5 underflow signal
10 10-14 ver.0.10 multijunction timers 10.2 common units of multijunction timer (3) output event bus the output event bus has the underflow signal from each timer connected to it, and is comprised of four lines of output event bus 0-3. output event bus signals are connected to output flip-flops, and can also be connected to other peripheral circuits-output event bus 3 to a-d0 converter, output event bus 0 to dma channel 1, and output event bus 1 to dma channel 2. furthermore, output event bus 2 can be connected to input event bus 3. the table below lists the signals that can be connected to the output event bus. table 10.2.3 signals that can be connected (fed) to each output event bus line output event bus connectable (acceptable) signal (note) 3 top8, tio3, tio4, or tio8 underflow signal 2 top9 or tio2 underflow signal 1 top7 or tio1 underflow signal 0 top6 or tio0 underflow signal note: for details about the output destinations of output event bus signals, refer to figure 10.1.1, "block diagram of mjt." timings at which signals are generated to the output event bus by each timer (and those generated to the input event bus by tio5, 6) are shown below. (note that they are generated at different timings than those forwarded to output flip-flops by timers.) table 10.2.4 timings at which signals are generated to the output event bus by each timer (1/2) timer mode timings at which signals are generated to the output event bus top single-shot output mode when the counter underflows delayed single-shot output mode when the counter underflows continuous output mode when the counter underflows tio (note) measure clear input mode when the counter underflows measure free-run input mode when the counter underflows noise processing input mode when the counter underflows pwm output mode when the counter underflows single-shot output mode when the counter underflows delayed single-shot output mode when the counter underflows continuous output mode when the counter underflows tms (16-bit measure input) no signal generation function tml (32-bit measure input) no signal generation function tid fixed period mode no signal generation function event count mode no signal generation function multiply-by-4 event count mode no signal generation function tod pwm output mode no signal generation function single-shot output mode no signal generation function delayed single-shot output mode no signal generation function continuous output mode no signal generation function note: tio5, 6 output underflow signals to the input event bus.
10 10-15 ver.0.10 multijunction timers 10.2 common units of multijunction timer table 10.2.4 timings at which signals are generated to the output event bus by each timer (2/2) timer mode timings at which signals are generated to the output event bus tom pwm output mode no signal generation function single-shot pwm output mode no signal generation function single-shot output mode no signal generation function continuous output mode no signal generation function figure 10.2.3 conceptual diagram of the clock bus and input/output event bus tclk0s tclk0 tin0 tin2 tin3 tin4 tin5 tin6 psc1 psc0 psc2 tclk3 udf tio 5 udf tio 6 s udf tio 7 udf top 6 udf top 7 udf top 8 udf top 9 udf tio 0 udf tio 1 udf tio 2 udf tio 3 udf tio 4 udf tio 8 tclk3s tin0s tin2s tin3s tin4s tin5s tin6s clock bus input event bus output event bus s : selector psc0 - 2 : prescaler 3210 3210 3210 3210 0123 0123 1/2 internal peripheral clock
10 10-16 ver.0.10 multijunction timers 10.2 common units of multijunction timer the clock bus/input-output bus control unit has the following registers: ? clock bus & input event bus control register (ckiebcr) ? output event bus control register (oebcr) n clock bus & input event bus control register (ckiebcr) d8 9 1011121314d15 ieb3s ieb2s ieb1s ieb0s ckb2s d bit name function r w 8, 9 ieb3s 0x : selects external input 3 (tin3) (input event bus 3 input selection) 10 : selects output event bus 2 11 : selects tio7 output 10, 11 ieb2s 00 : selects external input 0 (tin0) (input event bus 2 input selection) 01 : selects external input 2 (tin2) 1x : selects external input 4 (tin4) 12 ieb1s 0 : selects external input 5 (tin5) (input event bus 1 input selection) 1 : selects tio6 output 13 ieb0s 0 : selects external input 6 (tin6) (input event bus 0 input selection) 1 : selects tio5 output 14 no functions assigned 0 15 ckb2s 0 : selects prescaler 2 (clock bus 2 input selection) 1 : selects external clock 3 (tclk3) the register ckiebcr is used to select the clock source (external input or prescaler) supplied to the clock bus and the count enable/capture signal (external input or output event bus) supplied to the input event bus.
10 10-17 ver.0.10 multijunction timers 10.2 common units of multijunction timer n output event bus control register (oebcr) d8 9 1011121314d15 oeb3s oeb2s oeb1s oeb0s d bit name function r w 8, 9 oeb3s 00 : selects top8 output (output event bus 3 input selection) 01 : selects tio3 output 10 : selects tio4 output 11 : selects tio8 output 10 no functions assigned 0 11 oeb2s 0 : selects top9 output (output event bus 2 input selection) 1 : selects tio2 output 12 no functions assigned 0 13 oeb1s 0 : selects top7 output (output event bus 1 input selection) 1 : selects tio1 output 14 no functions assigned 0 15 oeb0s 0 : selects top6 output (output event bus 0 input selection) 1 : selects tio0 output the register oebcr is used to select the timer (top or tio) whose underflow signal is supplied to the output event bus.
10 10-18 ver.0.10 multijunction timers 10.2 common units of multijunction timer 10.2.4 input processing control unit the input processing control unit processes the tclk and tin signals fed into the mjt. in the tclk input processing unit, selection is made of the source of tclk signal, or for external input, the active edge (rising or falling or both) or level (high or low) of the signal, with or at which to generate the clock signal fed to the clock bus. in the tin input processing unit, selection is made of the active edge (rising or falling or both) or level (high or low) of the signal at which to generate the enable, measure or count source signal for each timer or the signal fed to each event bus. following input processing control registers are included: ? tclk input processing control register (tclkcr) ? tin input processing control register 0 (tincr0) ? tin input processing control register 1 (tincr1) ? tin input processing control register 2 (tincr2) ? tin input processing control register 3 (tincr3) ? tin input processing control register 4 (tincr4)
10 10-19 ver.0.10 multijunction timers 10.2 common units of multijunction timer (1) functions of tclk input processing control registers item function 1/2 internal peripheral clock rising clock edge falling clock edge both edges low level high level count clock 1/2 internal peripheral clock tclk count clock tclk count clock tclk count clock tclk count clock 1/2 internal peripheral clock tclk count clock 1/2 internal peripheral clock
10 10-20 ver.0.10 multijunction timers 10.2 common units of multijunction timer (2) functions of tin input processing control registers item function rising edge falling edge both edges low level high level tin internal edge signal tin internal edge signal tin internal ed g e si g nal tclk psc x clock width or tclk x input internal edge signal tin internal edge signal psc x clock width or tclk x input
10 10-21 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tclk3s tclk2s tclk1s tclk0s d bit name function r w 0, 1 no functions assigned 0 2, 3 tclk3s 00 : 1/2 internal peripheral clock (tclk3 input 01 : rising edge processing selection) 10 : falling edge 11 : both edges 4 no functions assigned 0 5 - 7 tclk2s 000 : invalidates input (tclk2 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 8 no functions assigned 0 9 - 11 tclk1s 000 : invalidates input (tclk1 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 12, 13 no functions assigned 0 14, 15 tclk0s 00 : 1/2 internal peripheral clock (tclk0 input 01 : rising edge processing selection) 10 : falling edge 11 : both edges note: this register must always be accessed in halfwords. n tlck input processing control register (tclkcr)
10 10-22 ver.0.10 multijunction timers 10.2 common units of multijunction timer d01234567891011121314d15 tin4s tin3s tin2s tin1s tin0s d bit name function r w 0 no functions assigned 0 1 - 3 tin4s 000 : invalidates input (tin4 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 4 no functions assigned 0 5 - 7 tin3s 000 : invalidates input (tin3 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 8, 9 no functions assigned 0 10, 11 tin2s 00 : invalidates input (tin2 input 01 : rising edge processing selection) 10 : falling edge 11 : both edges 12, 13 tin1s 00 : invalidates input (tin1 input 01 : rising edge processing selection) 10 : falling edge 11 : both edges 14, 15 tin0s 00 : invalidates input (tin0 input 01 : rising edge processing selection) 10 : falling edge 11 : both edges note: this register must always be accessed in halfwords. n tin input processing control register 0 (tincr0)
10 10-23 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tin8s tin7s tin6s tin5s d bit name function r w 0 no functions assigned 0 1 - 3 tin8s 000 : invalidates input (tin8 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 4 no functions assigned 0 5 - 7 tin7s 000 : invalidates input (tin7 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 8 no functions assigned 0 9 - 11 tin6s 000 : invalidates input (tin6 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 12 no functions assigned 0 13 - 15 tin5s 000 : invalidates input (tin5 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level note: this register must always be accessed in halfwords. n tin input processing control register 1 (tincr1)
10 10-24 ver.0.10 multijunction timers 10.2 common units of multijunction timer d01234567891011121314d15 tin11s tin10s tin9s d bit name function r w 0 - 4 no functions assigned 0 5 - 7 tin11s 000 : invalidates input (tin11 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 8 no functions assigned 0 9 - 11 tin10s 000 : invalidates input (tin10 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level 12 no functions assigned 0 13 - 15 tin9s 000 : invalidates input (tin9 input 001 : rising edge processing selection) 010 : falling edge 011 : both edges 10x : low level 11x : high level note: this register must always be accessed in halfwords. n tin input processing control register 2 (tincr2)
10 10-25 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tin19s tin18s tin17s tin16s tin15s tin14s tin13s tin12s d bit name function r w 0, 1 tin19s (tin19 input processing selection) 00 : invalidates input 2, 3 tin18s (tin18 input processing selection) 01 : rising edge 4, 5 tin17s (tin17 input processing selection) 10 : falling edge 6, 7 tin16s (tin16 input processing selection) 11 : both edges 8, 9 tin15s (tin15 input processing selection) 10, 11 tin14s (tin14 input processing selection) 12, 13 tin13s (tin13 input processing selection) 14, 15 tin12s (tin12 input processing selection) note: this register must always be accessed in halfwords. n tin input processing control register 4 (tincr4) n tin input processing control register 3 (tincr3) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tin33s tin32s tin31s tin30s tin23s tin22s tin21s tin20s d bit name function r w 0, 1 tin33s (tin33 input processing selection) 00 : invalidates input 2, 3 tin32s (tin32 input processing selection) 01 : rising edge 4, 5 tin31s (tin31 input processing selection) 10 : falling edge 6, 7 tin30s (tin30 input processing selection) 11 : both edges 8, 9 tin23s (tin23 input processing selection) 10, 11 tin22s (tin22 input processing selection) 12, 13 tin21s (tin21 input processing selection) 14, 15 tin20s (tin20 input processing selection) note: this register must always be accessed in halfwords.
10 10-26 ver.0.10 multijunction timers 10.2 common units of multijunction timer 10.2.5 output flip-flop control unit the output flip-flop control unit controls the flip-flop (f/f) provided for each timer output. following flip-flop control registers are included: ? f/f source select register 0 (ffs0) ? f/f source select register 1 (ffs1) ? f/f protect register 0 (ffp0) ? f/f protect register 1 (ffp1) ? f/f protect register 2 (ffp2) ? f/f protect register 3 (ffp3) ? f/f protect register 4 (ffp4) ? f/f data register 0 (ffd0) ? f/f data register 1 (ffd1) ? f/f data register 2 (ffd2) ? f/f data register 3 (ffd3) ? f/f data register 4 (ffd4) timings at which signals are generated to the output flip-flop by each timer are shown in table 10.2.5 below. (note that signals are generated at different timings than those fed to the output event bus.)
10 10-27 ver.0.10 multijunction timers 10.2 common units of multijunction timer table 10.2.5 timings at which signals are generated to the output flip-flop by each timer timer mode timings at which signals are generated to the output flip-flop top single-shot output mode when counter is enabled and when underflows delayed single-shot output mode when counter underflows continuous output mode when counter is enabled and when underflows tio measure clear input mode when counter underflows measure free-run input mode when counter underflows noise processing input mode when counter underflows pwm output mode when counter is enabled and when underflows single-shot output mode when counter is enabled and when underflows delayed single-shot output mode when counter underflows continuous output mode when counter is enabled and when underflows tms (16-bit measure input) no signal generation function tml (32-bit measure input) no signal generation function tid fixed period count mode no signal generation function event count mode no signal generation function multiply-by-4 event count mode no signal generation function tod pwm output mode when counter is enabled and when underflows single-shot output mode when counter is enabled and when underflows delayed single-shot output mode when counter underflows continuous output mode when counter is enabled and when underflows tom pwm output mode when counter is enabled and when underflows single-shot pwm output mode when counter underflows single-shot output mode when counter is enabled and when underflows continuous output mode when counter is enabled and when underflows
10 10-28 ver.0.10 figure 10.2.4 configuration of the f/f output circuit multijunction timers 10.2 common units of multijunction timer output event bus 0 dn f/f protect (fpn) wr dn output control (on/off) ton internal edge signal port operation mode register(pnmod) f/fn output data (fdn) top tio tod tom udf f/f source selection (ffn) output event bus 1 output event bus 2 output event bus 3 note: dn denotes the data bus. f/f f/f f/f
10 10-29 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 ff15 ff14 ff13 ff12 ff11 ff10 ff9 ff8 ff7 ff6 d bit name function r w 0 - 2 no functions assigned 0 3 ff15 (f/f15 source selection) 0 : tio4 output 1 : output event bus 0 4 ff14 (f/f14 source selection) 0 : tio3 output 1 : output event bus 0 5 ff13 (f/f13 source selection) 0 : tio2 output 1 : output event bus 3 6 ff12 (f/f12 source selection) 0 : tio1 output 1 : output event bus 2 7 ff11 (f/f11 source selection) 0 : tio0 output 1 : output event bus 1 8, 9 ff10 (f/f10 source selection) 0x : top10 output 10 : output event bus 0 11 : output event bus 1 10, 11 ff9 (f/f9 source selection) 0x : top9 output 10 : output event bus 0 11 : output event bus 1 12, 13 ff8 (f/f8 source selection) 00 : top8 output 01 : output event bus 0 10 : output event bus 1 11 : output event bus 2 14 ff7 (f/f7 source selection) 0 : top7 output 1 : output event bus 0 15 ff6 (f/f6 source selection) 0 : top6 output 1 : output event bus 1 note: this register must always be accessed in halfwords. n f/f source select register 0 (ffs0)
10 10-30 ver.0.10 multijunction timers 10.2 common units of multijunction timer n f/f source select register 1 (ffs1) d8 9 1011121314d15 ff19 ff18 ff17 ff16 d bit name function r w 8, 9 ff19 (f/f19 source selection) 0x : tio8 output 10 : output event bus 0 11 : output event bus 1 10, 11 ff18 (f/f18 source selection) 0x : tio7 output 10 : output event bus 0 11 : output event bus 1 12, 13 ff17 (f/f17 source selection) 0x : tio6 output 10 : output event bus 0 11 : output event bus 1 14, 15 ff16 (f/f16 source selection) 00 : tio5 output 01 : output event bus 0 10 : output event bus 1 11 : output event bus 3 the registers ffs0 and ffs1 are used to select the signal sources fed to each output f/f (flip- flop). for these signal sources, you can choose signals from the internal output bus or underflow output from each timer.
10 10-31 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 fp15 fp14 fp13 fp12 fp11 fp10 fp9 fp8 fp7 fp6 fp5 fp4 fp3 fp2 fp1 fp0 d bit name function r w 0 fp15 (f/f15 protect) 0 : enables write to f/f output bit 1 fp14 (f/f14 protect) 1 : disables write to f/f output bit 2 fp13 (f/f13 protect) 3 fp12 (f/f12 protect) 4 fp11 (f/f11 protect) 5 fp10 (f/f10 protect) 6 fp9 (f/f9 protect) 7 fp8 (f/f8 protect) 8 fp7 (f/f7 protect) 9 fp6 (f/f6 protect) 10 fp5 (f/f5 protect) 11 fp4 (f/f4 protect) 12 fp3 (f/f3 protect) 13 fp2 (f/f2 protect) 14 fp1 (f/f1 protect) 15 fp0 (f/f0 protect) note: this register must always be accessed in halfwords. this register controls write to each output f/f (flip-flop) by enabling or disabling it. when this register is set to disable write to any output f/f, writing to the f/f data register has no effect. n f/f protect register 0 (ffp0)
10 10-32 ver.0.10 multijunction timers 10.2 common units of multijunction timer d8 9 1011121314d15 fp20 fp19 fp18 fp17 fp16 d bit name function r w 8 - 10 no functions assigned 0 11 fp20 (f/f20 protect) 0 : enables write to f/f output bit 12 fp19 (f/f19 protect) 1 : disables write to f/f output bit 13 fp18 (f/f18 protect) 14 fp17 (f/f17 protect) 15 fp16 (f/f16 protect) n f/f protect register 2 (ffp2) n f/f protect register 1 (ffp1) d8 9 1011121314d15 fp21 fp22 fp23 fp24 fp25 fp26 fp27 fp28 d bit name function r w 8 fp21 (f/f21 protect) 0 : enables write to f/f output bit 9 fp22 (f/f22 protect) 1 : disables write to f/f output bit 10 fp23 (f/f23 protect) 11 fp24 (f/f24 protect) 12 fp25 (f/f25 protect) 13 fp26 (f/f26 protect) 14 fp27 (f/f27 protect) 15 fp28 (f/f28 protect) this register controls write to each output f/f (flip-flop) by enabling or disabling it. when this register is set to disable write to any output f/f, writing to the f/f data register has no effect.
10 10-33 ver.0.10 multijunction timers 10.2 common units of multijunction timer d8 9 1011121314d15 fp29 fp30 fp31 fp32 fp33 fp34 fp35 fp36 d bit name function r w 8 fp29 (f/f29 protect) 0 : enables write to f/f output bit 9 fp30 (f/f30 protect) 1 : disables write to f/f output bit 10 fp31 (f/f31 protect) 11 fp32 (f/f32 protect) 12 fp33 (f/f33 protect) 13 fp34 (f/f34 protect) 14 fp35 (f/f35 protect) 15 fp36 (f/f36 protect) n f/f protect register 4 (ffp4) n f/f protect register 3 (ffp3) d8 9 1011121314d15 fp37 fp38 fp39 fp40 fp41 fp42 fp43 fp44 d bit name function r w 8 fp37 (f/f37 protect) 0 : enables write to f/f output bit 9 fp38 (f/f38 protect) 1 : disables write to f/f output bit 10 fp39 (f/f39 protect) 11 fp40 (f/f40 protect) 12 fp41 (f/f41 protect) 13 fp42 (f/f42 protect) 14 fp43 (f/f43 protect) 15 fp44 (f/f44 protect) this register controls write to each output f/f (flip-flop) by enabling or disabling it. when this register is set to disable write to any output f/f, writing to the f/f data register has no effect.
10 10-34 ver.0.10 multijunction timers 10.2 common units of multijunction timer d01234567891011121314d15 fd15 fd14 fd13 fd12 fd11 fd10 fd9 fd8 fd7 fd6 fd5 fd4 fd3 fd2 fd1 fd0 d bit name function r w 0 fd15 (f/f15 output data) 0 : f/f output data = 0 1 fd14 (f/f14 output data) 1 : f/f output data = 1 2 fd13 (f/f13 output data) 3 fd12 (f/f12 output data) 4 fd11 (f/f11 output data) 5 fd10 (f/f10 output data) 6 fd9 (f/f9 output data) 7 fd8 (f/f8 output data) 8 fd7 (f/f7 output data) 9 fd6 (f/f6 output data) 10 fd5 (f/f5 output data) 11 fd4 (f/f4 output data) 12 fd3 (f/f3 output data) 13 fd2 (f/f2 output data) 14 fd1 (f/f1 output data) 15 fd0 (f/f0 output data) note: this register must always be accessed in halfwords. this register is used to set data in each output f/f (flip-flop). normally, the data output from f/f changes with timer output, but by setting data 0 or 1 in this register you can produce the desired output from any f/f. the f/f data register can only be accessed for write when the f/f protect register described above is enabled for write. n f/f data register 0 (ffd0)
10 10-35 ver.0.10 multijunction timers 10.2 common units of multijunction timer d8 9 1011121314d15 fd20 fd19 fd18 fd17 fd16 d bit name function r w 8 - 10 no functions assigned 0 11 fd20 (f/f20 output data) 0 : f/f output data = 0 12 fd19 (f/f19 output data) 1 : f/f output data = 1 13 fd18 (f/f18 output data) 14 fd17 (f/f17 output data) 15 fd16 (f/f16 output data) n f/f data register 2 (ffd2) n f/f data register 1 (ffd1) d8 9 1011121314d15 fd21 fd22 fd23 fd24 fd25 fd26 fd27 fd28 d bit name function r w 8 fd21 (f/f21 output data) 0 : f/f output data = 0 9 fd22 (f/f22 output data) 1 : f/f output data = 1 10 fd23 (f/f23 output data) 11 fd24 (f/f24 output data) 12 fd25 (f/f25 output data) 13 fd26 (f/f26 output data) 14 fd27 (f/f27 output data) 15 fd28 (f/f28 output data) this register is used to set data in each output f/f (flip-flop). normally, the data output from f/f changes with timer output, but by setting data 0 or 1 in this register you can produce the desired output from any f/f. the f/f data register can only be accessed for write when the f/f protect register described above is enabled for write.
10 10-36 ver.0.10 multijunction timers 10.2 common units of multijunction timer d8 9 1011121314d15 fd29 fd30 fd31 fd32 fd33 fd34 fd35 fd36 d bit name function r w 8 fd29 (f/f29 output data) 0 : f/f output data = 0 9 fd30 (f/f30 output data) 1 : f/f output data = 1 10 fd31 (f/f31 output data) 11 fd32 (f/f32 output data) 12 fd33 (f/f33 output data) 13 fd34 (f/f34 output data) 14 fd35 (f/f35 output data) 15 fd36 (f/f36 output data) n f/f data register 4 (ffd4) n f/f data register 3 (ffd3) d8 9 1011121314d15 fd37 fd38 fd39 fd40 fd41 fd42 fd43 fd44 d bit name function r w 8 fd37 (f/f37 output data) 0 : f/f output data = 0 9 fd38 (f/f38 output data) 1 : f/f output data = 1 10 fd39 (f/f39 output data) 11 fd40 (f/f40 output data) 12 fd41 (f/f41 output data) 13 fd42 (f/f42 output data) 14 fd43 (f/f43 output data) 15 fd44 (f/f44 output data) this register is used to set data in each output f/f (flip-flop). normally, the data output from f/f changes with timer output, but by setting data 0 or 1 in this register you can produce the desired output from any f/f. the f/f data register can only be accessed for write when the f/f protect register described above is enabled for write.
10 10-37 ver.0.10 multijunction timers 10.2 common units of multijunction timer 10.2.6 interrupt control unit the interrupt control unit controls the interrupt signals sent to the interrupt controller by each timer. following 22 timer interrupt control registers are provided for each timer. ? top interrupt control register 0 (topir0) ? top interrupt control register 1 (topir1) ? top interrupt control register 2 (topir2) ? top interrupt control register 3 (topir3) ? tio interrupt control register 0 (tioir0) ? tio interrupt control register 1 (tioir1) ? tio interrupt control register 2 (tioir2) ? tms interrupt control register (tmsir) ? tin interrupt control register 0 (tinir0) ? tin interrupt control register 1 (tinir1) ? tin interrupt control register 2 (tinir2) ? tin interrupt control register 3 (tinir3) ? tin interrupt control register 4 (tinir4) ? tin interrupt control register 5 (tinir5) ? tin interrupt control register 6 (tinir6) ? tin interrupt control register 7 (tinir7) ? tod0 interrupt mask register (tod0ima) ? tod0 interrupt status register (tod0ist) ? tod1 interrupt mask register (tod1ima) ? tod1 interrupt status register (tod1ist) ? tom0 interrupt mask register (tom0ima) ? tom0 interrupt status register (tom0ist) for interrupts which have only one source of interrupt in one interrupt table, no interrupt control registers are provided in the timer, and the interrupt status flags are automatically managed within the interrupt controller. for details, refer to chapter 14, "interrupt controller." ? top10 mjt output interrupt 5 (irq5) ? tid0 tid0 output interrupt (irq14) ? tid1 tid1 output interrupt (irq15) ? tid2 tid2 output interrupt (irq17)
10 10-38 ver.0.10 multijunction timers 10.2 common units of multijunction timer for interrupts which have two or more sources of interrupt in one interrupt table, interrupt control registers are provided, with which to control interrupt requests and determine interrupt input. therefore, the status flags in the interrupt controller function only as a bit to show whether an interrupt-enabled interrupt request occurred and cannot be written to. (1) interrupt request status bit this status bit shows whether an interrupt request occurred. when an interrupt request is generated, this bit is set in hardware (but cannot be set in software). the status bit is cleared by writing a 0, but not affected by writing a 1, in which case the bit holds the status intact. because the status bit is unaffected by interrupt mask bits, it can also be used to check the operation of peripheral function. in interrupt processing, make sure that among grouped interrupt flags, only the flag for the serviced interrupt is cleared. clearing flags for unserviced interrupts results in the pending interrupt requests also being cleared. (2) interrupt mask bit this bit is used to disable unnecessary interrupts among grouped interrupt requests. set this bit to 0 to enable interrupts or 1 to disable interrupts. figure 10.2.5 interrupt status register and mask register interrupt controller each timer or tin input interrupt request interrupt status data bus set group interrupt interrupt enable clear f/f f/f data = 0
10 10-39 ver.0.10 multijunction timers 10.2 common units of multijunction timer figure 10.2.6 example for clearing the interrupt status b4 5 6 b7 interrupt status flag initial state b6 event occurred interrupt request b4 event occurred only b6 cleared b4 data retained b4 5 6 b7 1 101 write to the interrupt status example for clearing the interrupt status 0 000 0 010 0 110 0 100
10 10-40 ver.0.10 multijunction timers 10.2 common units of multijunction timer the table below shows the relationship between the interrupt signals generated by multijunction timers and the interrupt sources input to the interrupt controller. table 10.2.6 interrupt signals generated by mjt signal name source of interrupt generated interrupt sources input to icu (note 1) number of input sources irq0 tio0, tio1, tio2, tio3 mjt output interrupt 0 4 irq1 top6, top7 mjt output interrupt 1 2 irq2 top0, top1, top2, top3, top4, top5 mjt output interrupt 2 6 irq3 tio8, tio9 mjt output interrupt 3 2 irq4 tio4, tio5, tio6, tio7 mjt output interrupt 4 4 irq6 top8, top9 mjt output interrupt 6 2 irq7 tms0, tms1 mjt output interrupt 7 2 irq8 tin7, tin8, tin9, tin10, tin11 mjt input interrupt 0 5 irq9 tin0, tin1, tin2 mjt input interrupt 1 3 irq10 tin12, tin13, tin14, tin15, tin16, mjt input interrupt 2 8 tin17, tin18, tin19 irq11 tin20, tin21, tin22, tin23 mjt input interrupt 3 4 irq12 tin3, tin4, tin5, tin6 mjt input interrupt 4 4 irq13 tod0_0, tod0_1, tod0_2, tod0_3, tod0 output interrupt 8 tod0_4, tod0_5, tod0_6, tod0_7 irq16 tod1_0, tod1_1, tod1_2, tod1_3, tod1 + tom0 output interrupt 16 tod1_4, tod1_5, tod1_6, tod1_7, tom0_0, tom0_1, tom0_2, tom0_3, tom0_4, tom0_5, tom0_6, tom0_7 irq18 tin30, tin31, tin32, tin33 tml1 input interrupt 4 note 1: refer to chapter 5, "interrupt controller (icu)." note 2: for top10 and tid0-2, there are no interrupt status and mask bits in mjt interrupt control registers because they only have one source of interrupt in the group. (they are controlled directly by the interrupt controller.)
10 10-41 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 topis5 topis4 topis3 topis2 topis1 topis0 d bit name function r w 0, 1 no functions assigned 0 2 topis5 (top5 interrupt status) 0 : no interrupt request 3 topis4 (top4 interrupt status) 1 : interrupt request generated 4 topis3 (top3 interrupt status) 5 topis2 (top2 interrupt status) 6 topis1 (top1 interrupt status) 7 topis0 (top0 interrupt status) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n top interrupt control register 1 (topir1) n top interrupt control register 0 (topir0) d8 9 1011121314d15 topim5 topim4 topim3 topim2 topim1 topim0 d bit name function r w 8, 9 no functions assigned 0 10 topim5 (top5 interrupt mask) 0 : enables interrupt request 11 topim4 (top4 interrupt mask) 1 : masks (disables) interrupt request 12 topim3 (top3 interrupt mask) 13 topim2 (top2 interrupt mask) 14 topim1 (top1 interrupt mask) 15 topim0 (top0 interrupt mask)
10 10-42 ver.0.10 multijunction timers 10.2 common units of multijunction timer figure 10.2.7 block diagram of mjt output interrupt 2 mjt output interrupt 2 irq2 data bus b2 topis5 f/f topim5 f/f b10 b3 topis4 f/f topim4 f/f b11 b4 topis3 f/f topim3 f/f b12 b5 topis2 f/f topim2 f/f b13 b6 topis1 f/f topim1 f/f b14 b7 topis0 f/f topim0 f/f b15 (level) 6-source inputs topir0 topir1 top5udf top4udf top3udf top2udf top1udf top0udf
10 10-43 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 topis7 topis6 topim7 topim6 d bit name function r w 0, 1 no functions assigned 0 2 topis7 (top7 interrupt status) 0 : no interrupt request 3 topis6 (top6 interrupt status) 1 : interrupt request generated 4, 5 no functions assigned 0 6 topim7 (top7 interrupt mask) 0 : enables interrupt request 7 topim6 (top6 interrupt mask) 1 : masks (disables) interrupt request w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n top interrupt control register 2 (topir2) figure 10.2.8 block diagram of mjt output interrupt 1 b2 topis7 f/f topim7 f/f b6 b3 topis6 f/f topim6 f/f b7 topir2 top7udf top6udf data bus mjt output interrupt 1 irq1 (level) 2-source inputs
10 10-44 ver.0.10 multijunction timers 10.2 common units of multijunction timer d8 9 1011121314d15 topis9 topis8 topim9 topim8 d bit name function r w 8, 9 no functions assigned 0 10 topis9 (top9 interrupt status) 0 : no interrupt request 11 topis8 (top8 interrupt status) 1 : interrupt request generated 12, 13 no functions assigned 0 14 topim9 (top9 interrupt mask) 0 : enables interrupt request 15 topim8 (top8 interrupt mask) 1 : masks (disables) interrupt request w = : only writing a 0 is effective; when you write a 1, the previous value is retained. note: for top10, there are no interrupt status and mask bits in mjt interrupt control registers because it only has one source of interrupt in the group. (it is controlled directly by the interrupt controller.) n top interrupt control register 3 (topir3) figure 10.2.9 block diagram of mjt output interrupt 6 b10 topis9 f/f topim9 f/f b14 b11 topis8 f/f topim8 f/f b15 topir3 top9udf top8udf data bus mjt output interrupt 6 irq6 (level) 2-source inputs
10 10-45 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tiois3 tiois2 tiois1 tiois0 tioim3 tioim2 tioim1 tioim0 d bit name function r w 0 tiois3 (tio3 interrupt status) 0 : no interrupt request 1 tiois2 (tio2 interrupt status) 1 : interrupt request generated 2 tiois1 (tio1 interrupt status) 3 tiois0 (tio0 interrupt status) 4 tioim3 (tio3 interrupt mask) 0 : enables interrupt request 5 tioim2 (tio2 interrupt mask) 1 : masks (disables) interrupt request 6 tioim1 (tio1 interrupt mask) 7 tioim0 (tio0 interrupt mask) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n tio interrupt control register 0 (tioir0) figure 10.2.10 block diagram of mjt output interrupt 0 b0 tiois3 f/f tioim3 f/f b4 b1 tiois2 f/f tioim2 f/f b5 b2 tiois1 f/f tioim1 f/f b6 b3 tiois0 f/f tioim0 f/f b7 tioir0 tio3udf tio2udf tio1udf tio0udf data bus mjt output interrupt 0 irq0 (level) 4-source inputs
10 10-46 ver.0.10 multijunction timers 10.2 common units of multijunction timer d8 9 1011121314d15 tiois7 tiois6 tiois5 tiois4 tioim7 tioim6 tioim5 tioim4 d bit name function r w 8 tiois7 (tio7 interrupt status) 0 : no interrupt request 9 tiois6 (tio6 interrupt status) 1 : interrupt request generated 10 tiois5 (tio5 interrupt status) 11 tiois4 (tio4 interrupt status) 12 tioim7 (tio7 interrupt mask) 0 : enables interrupt request 13 tioim6 (tio6 interrupt mask) 1 : masks (disables) interrupt request 14 tioim5 (tio5 interrupt mask) 15 tioim4 (tio4 interrupt mask) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n tio interrupt control register 1 (tioir1) figure 10.2.11 block diagram of mjt output interrupt 4 b8 tiois7 f/f tioim7 f/f b12 b9 tiois6 f/f tioim26 f/f b13 b10 tiois5 f/f tioim5 f/f b14 b11 tiois4 f/f tioim4 f/f b15 tioir1 tio7udf tio6udf tio5udf tio4udf data bus mjt output interrupt 4 irq4 (level) 4-source inputs
10 10-47 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tiois9 tiois8 tioim9 tioim8 d bit name function r w 0, 1 no functions assigned 0 2 tiois9 (tio9 interrupt status) 0 : no interrupt request 3 tiois8 (tio8 interrupt status) 1 : interrupt request generated 4, 5 no functions assigned 0 6 tioim9 (tio9 interrupt mask) 0 : enables interrupt request 7 tioim8 (tio8 interrupt mask) 1 : masks (disables) interrupt request w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n tio interrupt control register 2 (tioir2) figure 10.2.12 block diagram of mjt output interrupt 3 b2 tiois9 f/f tioim9 f/f b6 b3 tiois8 f/f tioim8 f/f b7 tioir2 tio9udf tio8udf data bus mjt output interrupt 3 irq3 (level) 2-source inputs
10 10-48 ver.0.10 multijunction timers 10.2 common units of multijunction timer d8 9 1011121314d15 tmsis1 tmsis0 tmsim1 tmsim0 d bit name function r w 8, 9 no functions assigned 0 10 tmsis1 (tms1 interrupt status) 0 : no interrupt request 11 tmsis0 (tms0 interrupt status) 1 : interrupt request generated 12, 13 no functions assigned 0 14 tmsim1 (tms1 interrupt mask) 0 : enables interrupt request 15 tmsim0 (tms0 interrupt mask) 1 : masks (disables) interrupt request w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n tms interrupt control register (tmsir) figure 10.2.13 block diagram of mjt output interrupt 7 b10 tmsis1 f/f tmsim1 f/f b14 b11 tmsis0 f/f tmsim0 f/f b15 tmsir tms1ovf tms0ovf data bus mjt output interrupt 7 irq7 (level) 2-source inputs
10 10-49 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tinis2 tinis1 tinis0 tinim2 tinim1 tinim0 d bit name function r w 0 no functions assigned 0 1 tinis2 (tin2 interrupt status) 0 : no interrupt request 2 tinis1 (tin1 interrupt status) 1 : interrupt request generated 3 tinis0 (tin0 interrupt status) 4 no functions assigned 0 5 tinim2 (tin2 interrupt mask) 0 : enables interrupt request 6 tinim1 (tin1 interrupt mask) 1 : masks (disables) interrupt request 7 tinim0 (tin0 interrupt mask) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n tin interrupt control register 0 (tinir0) figure 10.2.14 block diagram of mjt input interrupt 1 b1 tinis2 f/f tinim2 f/f b5 b2 tinis1 f/f tinim1 f/f b6 b3 tinis0 f/f tinim0 f/f b7 tinir0 tin2edge tin1edge tin0edge data bus mjt input interrupt 1 irq9 (level) 3-source inputs
10 10-50 ver.0.10 multijunction timers 10.2 common units of multijunction timer d8 9 1011121314d15 tinis6 tinis5 tinis4 tinis3 tinim6 tinim5 tinim4 tinim3 d bit name function r w 8 tinis6 (tin6 interrupt status) 0 : no interrupt request 9 tinis5 (tin5 interrupt status) 1 : interrupt request generated 10 tinis4 (tin4 interrupt status) 11 tinis3 (tin3 interrupt status) 12 tinim6 (tin6 interrupt mask) 0 : enables interrupt request 13 tinim5 (tin5 interrupt mask) 1 : masks (disables) interrupt request 14 tinim4 (tin4 interrupt mask) 15 tinim3 (tin3 interrupt mask) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n tin interrupt control register 1 (tinir1) figure 10.2.15 block diagram of mjt input interrupt 4 b8 tinis6 f/f tinim6 f/f b12 b9 tinis5 f/f tinim5 f/f b13 b10 tinis4 f/f tinim4 f/f b14 tinir1 tin6edge tin5edge tin4edge b11 tinis3 f/f tinim3 f/f b15 tin3edge data bus mjt input interrupt 4 irq2 (level) 4-source inputs
10 10-51 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tinis11 tinis10 tinis9 tinis8 tinis7 d bit name function r w 0,1,2 no functions assigned 0 3 tinis11 (tin11 interrupt status) 0 : no interrupt request 4 tinis10 (tin10 interrupt status) 1 : interrupt request generated 5 tinis9 (tin9 interrupt status) 6 tinis8 (tin8 interrupt status) 7 tinis7 (tin7 interrupt status) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n tin interrupt control register 3 (tinir3) n tin interrupt control register 2 (tinir2) d8 9 1011121314d15 tinim11 tinim10 tinim9 tinim8 tinim7 d bit name function r w 8,9,10 no functions assigned 0 11 tinim11 (tin11 interrupt mask) 0 : enables interrupt request 12 tinim10 (tin10 interrupt mask) 1 : masks (disables) interrupt request 13 tinim9 (tin9 interrupt mask) 14 tinim8 (tin8 interrupt mask) 15 tinim7 (tin7 interrupt mask)
10 10-52 ver.0.10 figure 10.2.16 block diagram of mjt input interrupt 0 multijunction timers 10.2 common units of multijunction timer b3 tinis11 f/f tinim11 f/f b11 b4 tinis10 f/f tinim4 f/f b12 b5 tinis9 f/f tinim9 f/f b13 b6 tinis8 f/f tinim8 f/f b14 b7 tinis7 f/f tinim7 f/f b15 tinir2 tinir3 tin11edge tin10edge tin9edge tin8edge tin7edge data bus mjt input interrupt 0 irq8 (level) 5-source inputs
10 10-53 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tinis19 tinis18 tinis17 tinis16 tinis15 tinis14 tinis13 tinis12 d bit name function r w 0 tinis19 (tin19 interrupt status) 0 : no interrupt request 1 tinis18 (tin18 interrupt status) 1 : interrupt request generated 2 tinis17 (tin17 interrupt status) 3 tinis16 (tin16 interrupt status) 4 tinis15 (tin15 interrupt status) 5 tinis14 (tin14 interrupt status) 6 tinis13 (tin13 interrupt status) 7 tinis12 (tin12 interrupt status) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. n tin interrupt control register 5 (tinir5) n tin interrupt control register 4 (tinir4) d8 9 1011121314d15 tinim19 tinim18 tinim17 tinim16 tinim15 tinim14 tinim13 tinim12 d bit name function r w 8 tinim19 (tin19 interrupt mask) 0 : enables interrupt request 9 tinim18 (tin18 interrupt mask) 1 : masks (disables) interrupt request 10 tinim17 (tin17 interrupt mask) 11 tinim16 (tin16 interrupt mask) 12 tinim15 (tin15 interrupt mask) 13 tinim14 (tin14 interrupt mask) 14 tinim13 (tin13 interrupt mask) 15 tinim12 (tin12 interrupt mask)
10 10-54 ver.0.10 figure 10.2.17 block diagram of mjt input interrupt 2 multijunction timers 10.2 common units of multijunction timer b0 tinis19 f/f tinim19 f/f b8 b1 tinis18 f/f tinim18 f/f b9 b2 tinis17 f/f tinim17 f/f b10 b3 tinis16 f/f tinim16 f/f b11 b4 tinis15 f/f tinim15 f/f b12 tinir4 tinir5 tin19edge tin18edge tin17edge tin16edge tin15edge b5 tinis14 f/f tinim14 f/f b13 b6 tinis13 f/f tinim13 f/f b14 b7 tinis12 f/f tinim12 f/f b15 tin14edge tin13edge tin12edge data bus mjt input interrupt 2 irq10 (level) 8-source inputs
10 10-55 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tinis23 tinis22 tinis21 tinis20 tinim23 tinim22 tinim21 tinim20 d bit name function r w 0 tinis23 (tin23 interrupt status) 0 : no interrupt request 1 tinis22 (tin22 interrupt status) 1 : interrupt request generated 2 tinis21 (tin21 interrupt status) 3 tinis20 (tin20 interrupt status) 4 tinim23 (tin23 interrupt mask) 0 : enables interrupt request 5 tinim22 (tin22 interrupt mask) 1 : masks (disables) interrupt request 6 tinim21 (tin21 interrupt mask) 7 tinim20 (tin20 interrupt mask) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. figure 10.2.18 block diagram of mjt input interrupt 3 n tin interrupt control register 6 (tinir6) b0 tinis23 f/f tinim23 f/f b4 b1 tinis22 f/f tinim22 f/f b5 b2 tinis21 f/f tinim21 f/f b6 b3 tinis20 f/f tinim20 f/f b7 tinir6 tin23edge tin22edge tin21edge tin20edge data bus mjt input interrupt 3 irq11 (level) 4-source inputs
10 10-56 ver.0.10 d8 9 1011121314d15 tinis33 tinis32 tinis31 tinis30 tinim33 tinim32 tinim31 tinim30 d bit name function r w 8 tinis33 (tin33 interrupt status) 0 : no interrupt request 9 tinis32 (tin32 interrupt status) 1 : interrupt request generated 10 tinis31 (tin31 interrupt status) 11 tinis30 (tin30 interrupt status) 12 tinim33 (tin33 interrupt mask) 0 : enables interrupt request 13 tinim32 (tin32 interrupt mask) 1 : masks (disables) interrupt request 14 tinim31 (tin31 interrupt mask) 15 tinim30 (tin30 interrupt mask) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. note : for tin24-tin29, there are no interrupt status and mask bits in mjt interrupt control registers because they do not have interrupt functions. n tin interrupt control register 7 (tinir7) figure 10.2.19 block diagram of tml1 input interrupt b8 tinis33 f/f tinim33 f/f b12 b9 tinis32 f/f tinim32 f/f b13 b10 tinis31 f/f tinim31 f/f b14 b11 tinis30 f/f tinim30 f/f b15 tinir7 tin33edge tin32edge tin31edge tin30edge data bus tml1 input interrupt irq18 (level) 4-source inputs
10 10-57 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tod07ima tod06ima tod05ima tod04ima tod03ima tod02ima tod01ima tod00ima d bit name function r w 0 tod07ima (tod0_7 interrupt mask) 0 : enables interrupt request 1 tod06ima (tod0_6 interrupt mask) 1 : masks (disables) interrupt request 2 tod05ima (tod0_5 interrupt mask) 3 tod04ima (tod0_4 interrupt mask) 4 tod03ima (tod0_3 interrupt mask) 5 tod02ima (tod0_2 interrupt mask) 6 tod01ima (tod0_1 interrupt mask) 7 tod00ima (tod0_0 interrupt mask) n tod0 interrupt status register (tod0ist) n tod0 interrupt mask register (tod0ima) d8 9 1011121314d15 tod07ist tod06ist tod05ist tod04ist tod03ist tod02ist tod01ist tod00ist d bit name function r w 8 tod07ist (tod0_7 interrupt status) 0 : no interrupt request 9 tod06ist (tod0_6 interrupt status) 1 : interrupt request generated 10 tod05ist (tod0_5 interrupt status) 11 tod04ist (tod0_4 interrupt status) 12 tod03ist (tod0_3 interrupt status) 13 tod02ist (tod0_2 interrupt status) 14 tod01ist (tod0_1 interrupt status) 15 tod00ist (tod0_0 interrupt status) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
10 10-58 ver.0.10 multijunction timers 10.2 common units of multijunction timer figure 10.2.20 block diagram of tod0 output interrupt b8 tod07ist f/f tod07ima f/f b0 b9 tod06ist f/f tod06ima f/f b1 b10 tod05ist f/f tod05ima f/f b2 b11 tod04ist f/f tod04ima f/f b3 b12 tod03ist f/f tod03ima f/f b4 tod0ima tod0ist tod07udf tod06udf tod05udf tod04udf tod03udf b13 tod02ist f/f tod02ima f/f b5 b14 tod01ist f/f tod01ima f/f b6 b15 tod00ist f/f tod00ima f/f b7 tod02udf tod01udf tod00udf data bus tod0 output interrupt 2 irq13 (level) 8-source inputs
10 10-59 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tod17ima tod16ima tod15ima tod14ima tod13ima tod12ima tod11ima tod10ima d bit name function r w 0 tod17ima (tod1_7 interrupt mask) 0 : enables interrupt request 1 tod16ima (tod1_6 interrupt mask) 1 : masks (disables) interrupt request 2 tod15ima (tod1_5 interrupt mask) 3 tod14ima (tod1_4 interrupt mask) 4 tod13ima (tod1_3 interrupt mask) 5 tod12ima (tod1_2 interrupt mask) 6 tod11ima (tod1_1 interrupt mask) 7 tod10ima (tod1_0 interrupt mask) n tod1 interrupt status register (tod1ist) n tod1 interrupt mask register (tod1ima) d8 9 1011121314d15 tod17ist tod16ist tod15ist tod14ist tod13ist tod12ist tod11ist tod10ist d bit name function r w 8 tod17ist (tod1_7 interrupt status) 0 : no interrupt request 9 tod16ist (tod1_6 interrupt status) 1 : interrupt request generated 10 tod15ist (tod1_5 interrupt status) 11 tod14ist (tod1_4 interrupt status) 12 tod13ist (tod1_3 interrupt status) 13 tod12ist (tod1_2 interrupt status) 14 tod11ist (tod1_1 interrupt status) 15 tod10ist (tod1_0 interrupt status) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
10 10-60 ver.0.10 multijunction timers 10.2 common units of multijunction timer d0123456d7 tom07ima tom06ima tom05ima tom04ima tom03ima tom02ima tom01ima tom00ima d bit name function r w 0 tom07ima (tom0_7 interrupt mask) 0 : enables interrupt request 1 tom06ima (tom0_6 interrupt mask) 1 : masks (disables) interrupt request 2 tom05ima (tom0_5 interrupt mask) 3 tom04ima (tom0_4 interrupt mask) 4 tom03ima (tom0_3 interrupt mask) 5 tom02ima (tom0_2 interrupt mask) 6 tom01ima (tom0_1 interrupt mask) 7 tom00ima (tom0_0 interrupt mask) n tom0 interrupt status register (tom0ist) n tom0 interrupt mask register (tom0ima) d8 9 1011121314d15 tom07ist tom06ist tom05ist tom04ist tom03ist tom02ist tom01ist tom00ist d bit name function r w 8 tom07ist (tom0_7 interrupt status) 0 : no interrupt request 9 tom06ist (tom0_6 interrupt status) 1 : interrupt request generated 10 tom05ist (tom0_5 interrupt status) 11 tom04ist (tom0_4 interrupt status) 12 tom03ist (tom0_3 interrupt status) 13 tom02ist (tom0_2 interrupt status) 14 tom01ist (tom0_1 interrupt status) 15 tom00ist (tom0_0 interrupt status) w = : only writing a 0 is effective; when you write a 1, the previous value is retained.
10 10-61 ver.0.10 multijunction timers 10.2 common units of multijunction timer figure 10.2.21 block diagram of tod1 + tom0 output interrupt (1/2) b8 tod17ist f/f tod17ima f/f b0 b9 tod16ist f/f tod16ima f/f b1 b10 tod15ist f/f tod15ima f/f b2 b11 tod14ist f/f tod14ima f/f b3 b12 tod13ist f/f tod13ima f/f b4 tod1ima tod1ist tod17udf tod16udf tod15udf tod14udf tod13udf b13 tod12ist f/f tod12ima f/f b5 b14 tod11ist f/f tod11ima f/f b6 b15 tod10ist f/f to 8 input sources in the next page f/f b7 tod12udf tod11udf tod10udf tod10ima data bus tod1 + tom0 output interrupt irq16 (level) 16-source inputs
10 10-62 ver.0.10 multijunction timers 10.2 common units of multijunction timer figure 10.2.22 block diagram of tod1 + tom0 output interrupt (2/2) b8 tom07ist f/f tom07ima f/f b0 b9 tom06ist f/f tom06ima f/f b1 b10 tom05ist f/f tom05ima f/f b2 b11 tom04ist f/f tom04ima f/f b3 b12 tom03ist f/f tom03ima f/f b4 tom0ima tom0ist tom07udf tom06udf tom05udf tom04udf tom03udf b13 tom02ist f/f tom02ima f/f b5 b14 tom01ist f/f tom01ima f/f b6 b15 tom00ist f/f f/f b7 tom02udf tom01udf tom00udf tom00ima to the preceding page data bus
10 10-63 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3 top (output-related 16-bit timer) 10.3.1 outline of top top (timer output) is an output-related 16-bit timer, whose operation mode can be selected from the following by mode switching in software: ? single-shot output mode ? delayed single-shot output mode ? continuous output mode the table below shows specifications of top. the diagram in the next page shows a block diagram of top. table 10.3.1 specifications of top (output-related 16-bit timer) item specification number of channels 11 channels counter 16-bit down-counter reload register 16-bit reload register correction register 16-bit correction register timer startup started by writing to enable bit in software or by enabling with external input (rising or falling edge or both) mode selection ? single-shot output mode ? delayed single-shot output mode ? continuous output mode interrupt generation can be generated by a counter underflow
10 10-64 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.1 block diagram of top (output-related 16-bit timer) irq2 clk en udf top 0 clock bus input event bus clk en udf top 1 clk en udf top 2 clk en udf top 3 output event bus tclk0s to 0 irq9 3 2 1 0 clk en udf top 4 clk en udf top 5 tclk0 tin0 s s tin0s clk en udf top 6 clk en udf top 7 s s s irq9 tin1 irq9 tin2 s s clk en udf top 8 clk en udf top 9 clk en udf top 10 f/f0 f/f1 f/f2 f/f3 f/f4 f/f5 f/f6 f/f7 f/f8 f/f9 f/f10 s : selector f/f : output flip-flop s s s s s irq2 irq2 irq2 irq2 irq2 to 1 to 2 to 3 to 4 to 5 to 6 to 7 to 8 to 9 to 10 irq1 irq1 irq6 irq6 irq5 3 2 1 0 0 1 2 3 tin1s tin2s reload register down-counter correction register 3 2 1 0 3 2 1 0 0 1 2 3 (16 bits) drq7 drq8 drq9
10 10-65 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.2 outline of each mode of top each mode of top is outlined below. for each top channel, only one of the following modes can be selected. (1) single-shot output mode in single-shot output mode, the timer generates a pulse in width of (reload register set value + 1) only once and then stops without performing any operation. when after setting the reload register, the timer is enabled (by writing to the enable bit in software or by external input), the content of the reload register is loaded into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clock pulses and stops when it underflows after reaching the minimum count. the f/f output waveform in single-shot output mode is inverted at startup and upon underflow, generating a single-shot pulse waveform in width of (reload register set value + 1) only once. also, an interrupt can be generated when the counter underflows. (2) delayed single-shot output mode in delayed single-shot output mode, the timer generates a pulse in width of (reload register set value + 1) only once, with the output delayed by an amount of time equal to (counter set value + 1) and then stops without performing any operation. when after setting the counter and reload register, the timer is enabled (by writing to the enable bit in software or by external input), it starts counting down from the counter's set value synchronously with the count clock. the first time the counter underflows, the reload register value is loaded into the counter causing it to continue counting down, and the counter stops when it underflows next time. the f/f output waveform in delayed single-shot output mode is inverted when the counter underflows first time and next, generating a single-shot pulse waveform in width of (reload register set value + 1) only once, with the output delayed by an amount of time equal to (first set value of counter + 1) . also, an interrupt can be generated when the counter underflows first time and next. (3) continuous output mode in continuous output mode, the timer counts down clock pulses starting from the set value of the counter and when the counter underflows, reloads it with the reload register value. thereafter, this operation is repeated each time the counter underflows, thus generating consecutive pulses whose waveform is inverted in width of (reload register set value + 1).
10 10-66 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) when after setting the counter and reload register, the timer is enabled (by writing to the enable bit in software or by external input), it starts counting down from the counter's set value synchronously with the count clock and when the minimum count is reached, generates an underflow. this underflow causes the counter to be reloaded with the content of the reload register and start counting over again. thereafter, this operation is repeated each time an underflow occurs. to stop the counter, disable count by writing to the enable bit in software. the f/f output waveform in continuous output mode is inverted at startup and upon underflow, generating consecutive pulses until the timer stops counting. also, an interrupt can be generated each time the counter underflows.
10 10-67 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.3 top related register map the diagram below shows a top-related register map. figure 10.3.2 top related register map (1/3) h'0080 0240 address d0 d7 +0 address +1 address d8 d15 h'0080 0242 h'0080 0244 h'0080 0246 h'0080 0250 h'0080 0252 h'0080 0254 h'0080 0256 h'0080 0260 h'0080 0262 h'0080 0264 h'0080 0266 h'0080 0270 h'0080 0272 h'0080 0274 h'0080 0276 top0 counter (top0ct) top0 reload register (top0rl) top0 correction register (top0cc) note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. top1 counter (top1ct) top1 reload register (top1rl) top1 correction register (top1cc) top2 counter (top2ct) top2 reload register (top2rl) top2 correction register (top2cc) top3 counter (top3ct) top3 reload register (top3rl) top3 correction register (top3cc) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
10 10-68 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.3 top related register map (2/3) h'0080 0280 d0 d7 d8 d15 h'0080 0282 h'0080 0284 h'0080 0286 h'0080 0290 h'0080 0292 h'0080 0294 h'0080 0296 h'0080 02a0 h'0080 02a2 h'0080 02a4 h'0080 02a6 h'0080 02b0 h'0080 02b2 h'0080 02b4 h'0080 02b6 h'0080 0298 h'0080 029a h'0080 029c top0-5 control register 0 (top05cr0) top0-5 control register 1 (top05cr1) h'0080 02aa h'0080 02a8 address +0 address +1 address top4 counter (top4ct) top4 reload register (top4rl) top4 correction register (top4cc) top5 counter (top5ct) top5 reload register (top5rl) top5 correction register (top5cc) top6,7 control register (top67cr) top6 counter (top6ct) top6 reload register (top6rl) top6 correction register (top6cc) top7 counter (top7ct) top7 reload register (top7rl) top7 correction register (top7cc) note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
10 10-69 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.4 top related register map (3/3) h'0080 02c0 d0 d7 d8 d15 h'0080 02c2 h'0080 02c4 h'0080 02c6 h'0080 02d0 h'0080 02d2 h'0080 02d4 h'0080 02d6 h'0080 02e0 h'0080 02e2 h'0080 02e4 h'0080 02e6 h'0080 02fa h'0080 02fc h'0080 02fe top0-10 external enable enable register (topeen) h'0080 02ea top8-10 control register (top810cr) h'0080 02e8 top0-10 enable protect register (toppro) top0-10 count enable register (topcen) address +0 address +1 address top8 counter (top8ct) top8 reload register (top8rl) top8 correction register (top8cc) note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. top9 counter (top9ct) top9 reload register (top9rl) top9 correction register (top9cc) top9 counter (top9ct) top9 reload register (top9rl) top9 correction register (top9cc) top10 counter (top10ct) top10 reload register (top10rl) top10 correction register (top10cc) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
10 10-70 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.4 top control registers the top control registers are used to select operation modes of top0-10 (single-shot, delayed single-shot, or continuous mode), as well as select the counter enable and counter clock sources. following four top control registers are provided for each timer group. ? top0-5 control register 0 (top05cr0) ? top0-5 control register 1 (top05cr1) ? top6, 7 control register (top67cr) ? top8-10 control register (top810cr)
10 10-71 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) n top0-5 control register 0 (top05cr0) note 1: this register must always be accessed in halfwords. note 2: always make sure the counter has stopped and is idle before setting or changing operation modes. d bit name function r w 0,1 top3m (top3 operation mode selection) 00: single-shot output mode 2,3 top2m (top2 operation mode selection) 01: delayed single-shot output mode 4,5 top1m (top1 operation mode selection) 1x: continuous output mode 6,7 top0m (top0 operation mode selection) 8 no functions assigned 0 C 9-10 top05ens 0xx: external tin0 input (top0-5 enable source selection) 100: input event bus 0 101: input event bus 1 110: input event bus 2 111: input event bus 3 12,13 no functions assigned 0 C 14,15 top05cks 00: clock bus 0 (top0-5 clock source selection) 01: clock bus 1 10: clock bus 2 11: clock bus 3 d01234567891011121314d15 top3m top2m top1m top0m top05ens top05cks
10 10-72 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) n top0-5 control register 1 (top05cr1) d8 9 1011121314d15 top5m top4m note: always make sure the counter has stopped and is idle before setting or changing operation modes. figure 10.3.5 outline diagram of top0-5 clock/enable inputs d bit name function r w 8-11 no functions assigned 0 C 12,13 top5m (top5 operation mode selection) 00: single-shot output mode 14,15 top4m (top4 operation mode selection) 01: delayed single-shot output mode 1x: continuous output mode clk en top 0 clock bus input event bus clk en top 1 clk en top 2 clk en top 3 3 2 1 0 clk en top 4 clk en top 5 s s : selector tin0 s tin0s 3 2 1 0 note: this diagram is shown for the explanation of top control registers, and is partly omitted.
10 10-73 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 top7m top6m top67ens top67cks top7 ens n top6,7 control register (top67cr) note 1: this register must always be accessed in halfwords. note 2: always make sure the counter has stopped and is idle before setting or changing operation modes. d bit name function r w 0 no functions assigned 0 C 1 top7ens 0: result selected by top67ens bit (top7 enable source selection) 1: top6 output 2,3 top7m (top7 operation mode selection) 00: single-shot output mode 01: delayed single-shot output mode 1x: continuous output mode 4,5 no functions assigned 0 C 6,7 top6m (top6 operation mode selection) 00: single-shot output mode 01: delayed single-shot output mode 1x: continuous output mode 8 no functions assigned 0 C 9-11 top67ens 0xx: external tin1 input (top6, top7 enable source selection) 100: input event bus 0 101: input event bus 1 110: input event bus 2 111: input event bus 3 12,13 no functions assigned 0 C 14,15 top67cks 00: clock bus 0 (top6, top7 clock source selection) 01: clock bus 1 10: clock bus 2 11: clock bus 3
10 10-74 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.6 outline diagram of top6, top7 clock/enable inputs 3 2 1 0 clk en udf top 6 clk en udf top 7 s s tin1s tin1 s 3 2 1 0 s clock bus input event bus : selector note: this diagram is shown for the explanation of top control registers, and is partly omitted.
10 10-75 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) n top8-10 control register (top810cr) note 1: this register must always be accessed in halfwords. note 2: always make sure the counter has stopped and is idle before setting or changing operation modes. d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 top10m top9m top8m top810cks top 810 ens d bit name function r w 0,1 no functions assigned 0 C 2,3 top10m (top10 operation mode selection) 00: single-shot output mode 4,5 top9m (top9 operation mode selection) 01: delayed single-shot output mode 6,7 top8m (top8 operation mode selection) 1x: continuous output mode 8-10 no functions assigned 0 C 11 top810ens 0: external tin2 input (top8-10 enable source selection) 1: input event bus 3 12,13 no functions assigned 0 C 14,15 top810cks 00: clock bus 0 (top8-10 clock source selection) 01: clock bus 1 10: clock bus 2 01: clock bus 3
10 10-76 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.7 outline diagram of top8-10 clock/enable inputs 3 2 1 0 tin2 tin2s s s clk en top 8 clk en top 9 clk en top 10 s 3 2 1 0 clock bus input event bus : selector note: this diagram is shown for the explanation of top control registers, and is partly omitted.
10 10-77 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.5 top counters (top0ct-top10ct) n top0 counter (top0ct) n top1 counter (top1ct) n top2 counter (top2ct) n top3 counter (top3ct) n top4 counter (top4ct) n top5 counter (top5ct) n top6 counter (top6ct) n top7 counter (top7ct) n top8 counter (top8ct) n top9 counter (top9ct) n top10 counter (top10ct) note: this register must always be accessed in halfwords. the top counters are a 16-bit down-counter. after the timer is enabled (by writing to the enable bit in software or by external input), the counter starts counting synchronously with the count clock. d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 top0ct-top10ct d bit name function r w 0-15 top0ct-top10ct 16-bit counter value
10 10-78 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.6 top reload registers (top0rl-top10rl) n top0 reload register (top0rl) n top1 reload register (top1rl) n top2 reload register (top2rl) n top3 reload register (top3rl) n top4 reload register (top4rl) n top5 reload register (top5rl) n top6 reload register (top6rl) n top7 reload register (top7rl) n top8 reload register (top8rl) n top9 reload register (top9rl) n top10 reload register (top10rl) note : this register must always be accessed in halfwords. the top reload registers are used to load data into the top counter registers (top0ct- top10ct). it is in the following cases that the content of the reload register is loaded in the counter: ? when the counter is enabled in single-shot mode ? when the counter underflowed in delayed single-shot or continuous mode writing data to the reload register does not mean that the data is loaded into the counter simultaneously. note that data reloading after an underflow is performed synchronously with the clock period in which the counter underflowed. d bit name function r w 0-15 top0rl-top10rl 16-bit reload register value d01234567891011121314d15 top0rl-top10rl
10 10-79 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.7 top correction registers (top0cc-top10cc) n top0 correction register (top0cc) n top1 correction register (top1cc) n top2 correction register (top2cc) n top3 correction register (top3cc) n top4 correction register (top4cc) n top5 correction register (top5cc) n top6 correction register (top6cc) n top7 correction register (top7cc) n top8 correction register (top8cc) n top9 correction register (top9cc) n top10 correction register (top10cc) d bit name function r w 0-15 top0cc-top10cc 16-bit correction register value d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 top0cc-top10cc (acceptable set values +32767- C32768) note: this register must always be accessed in halfwords. the top correction registers are used to correct the top counter value by adding or subtracting it in the middle of operation. to increase or reduce the counter value, write a value to this correction register, the value by which you want to be increased or reduced from the initial count set in the counter. to add, write the value you want to add to the correction register directly as is; to subtract, write the two's complement of the value you want to subtract to the correction register. correction of the counter is performed synchronously with a clock period next to the one in which the correction value was written to the top correction register. in this case, one down-count in the clock period during which the correction was performed is canceled. therefore, note that the counter value actually is corrected by (correction register value + 1). for example, if the initial counter value is 10 and you write a value 3 to the correction register when the counter has counted down to 5, then the counter underflows after a total of 15 counts.
10 10-80 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.8 top enable control register n top0-10 external enable permit register (topeen) note: this register must always be accessed in halfwords. the top0-10 external enable permit register controls enable operation from sources external to the top counter by enabling or disabling it. d bit name function r w 0-4 no functions assigned 0 C 5 top10een (top10 external enable permit) 0: disables external enable 6 top9een (top9 external enable permit) 1: enables external enable 7 top8een (top8 external enable permit) 8 top7een (top7 external enable permit) 9 top6een (top6 external enable permit) 10 top5een (top5 external enable permit) 11 top4een (top4 external enable permit) 12 top3een (top3 external enable permit) 13 top2een (top2 external enable permit) 14 top1een (top1 external enable permit) 15 top0een (top0 external enable permit) d01234567891011121314d15 top10 top9 top8 top7 top6 top5 top4 top3 top2 top1 top0 een een een een een een een een een een een
10 10-81 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) n top0-10 enable protect register (toppro) note: this register must always be accessed in halfwords. the top0-10 enable protect register controls rewriting of the top0-10 count enable bits shown in the next page by enabling or disabling rewrite. d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 top10 top9 top8 top7 top6 top5 top4 top3 top2 top1 top0 pro pro pro pro pro pro pro pro pro pro pro d bit name function r w 0-4 no functions assigned 0 C 5 top10pro (top10 enable protect) 0: enables rewrite 6 top9pro (top9 enable protect) 1: disables rewrite 7 top8pro (top8 enable protect) 8 top7pro (top7 enable protect) 9 top6pro (top6 enable protect) 10 top5pro (top5 enable protect) 11 top4pro (top4 enable protect) 12 top3pro (top3 enable protect) 13 top2pro (top2 enable protect) 14 top1pro (top1 enable protect) 15 top0pro (top0 enable protect)
10 10-82 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) n top0-10 count enable register (topcen) note: this register must always be accessed in halfwords. the top0-10 count enable register controls the operation of top counter. to enable the counter in software, enable the relevant top0-10 enable protect register for write and set the count enable bit by writing a 1. to stop the counter, enable the top0-10 enable protect register for write and reset the count enable bit by writing a 0. in all but continuous mode, when the counter stops due to an occurrence of underflow, the count enable bit is automatically reset to 0. therefore, what you get by reading the top0-10 count enable register is the status that indicates the counter's operating status (active or idle). d bit name function r w 0-4 no functions assigned 0 C 5 top10cen (top10 count enable) 0: stops count 6 top9cen (top9 count enable) 1: enables count 7 top8cen (top8 count enable) 8 top7cen (top7 count enable) 9 top6cen (top6 count enable) 10 top5cen (top5 count enable) 11 top4cen (top4 count enable) 12 top3cen (top3 count enable) 13 top2cen (top2 count enable) 14 top1cen (top1 count enable) 15 top0cen (top0 count enable) d01234567891011121314d15 top10 top9 top8 top7 top6 top5 top4 top3 top2 top1 top0 cen cen cen cen cen cen cen cen cen cen cen
10 10-83 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.8 configuration of the top enable circuit wr dn topm enable protect (topmpro) wr en-on topm external enable (topmeen) tinns topm enable (topmcen) top enable control edge selection f/f f/f f/f event bus
10 10-84 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.9 operation in top single-shot output mode (with correction function) (1) outline of top single-shot output mode in single-shot output mode, the timer generates a pulse in width of (reload register value + 1) only once and stops without performing any operation. when after setting the reload register, the timer is enabled (by writing to the enable bit in software or by external input), it loads the content of the reload register into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clock pulses and stops when it underflows after reaching the minimum count. the f/f output waveform in single-shot output mode is inverted (f/f output levels change from low to high, or vice versa) at startup and upon underflow, generating a single-shot pulse waveform in width of (reload register set value + 1) only once. also, an interrupt can be generated when the counter underflows. the count value is (reload register set value + 1). in the case shown below, for example, if the reload register value = 7, then the count value = 8. because all internal circuits operate synchronously with the count clock, a finite time equal to a prescaler delay is included before f/f output changes state after the timer is enabled. figure 10.3.9 example of counting in top single-shot output mode enable reload register (7) 6 5 4 3 123 456 78 h'ffff 7 counter interrupt underflow count value =8 (note 1) note 1: what you actually see in the cycle immediately after reload is the previous counter value, and not 7. note 2: this diagram does not show detail timing information. 2 1 0 f/f output * a finite time equal to a prescaler delay is included before f/f output changes state after the timer is enabled. count clock
10 10-85 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) in the example below, the reload register has the initial value h'a000 set in it. (the initial value of the counter can be indeterminate, and does not have to be specific.) when the timer starts, the reload register value is loaded into the counter causing it to start counting. thereafter, it continues counting down clock pulses until it underflows after reaching the minimum count. figure 10.3.10 typical operation in top single-shot output mode aaaaaaaaaaa aaaaaaaaaaa count clock correction register h'ffff h'0000 enabled (by writing to enable bit or by external input) f/f output disabled (by underflow) (not used) top interrupt due to underflow enable bit starts counting down from the reload register set value note: this diagram does not show detail timing information. reload register h'a000 data inverted by enable counter h'a000 data inverted by underflow h'ffff
10 10-86 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) (2) correction function of top single-shot output mode if you want to change the counter value during operation, write a value to the top correction register, the value by which you want to be increased or reduced from the initial count set in the counter. to add, write the value you want to add to the correction register directly as is; to subtract, write the two's complement of the value you want to subtract to the correction register. correction of the counter is performed synchronously with a clock period next to the one in which the correction value was written to the top correction register. in this case, one down-count in the clock period during which the correction was performed is canceled. therefore, note that the counter value actually is corrected by (correction register value + 1). for example, if the initial counter value is 7 and you write a value 3 to the correction register when the counter has counted down to 3, then the counter underflows after a total of 12 counts. figure 10.3.11 example of counting in top single-shot output mode when count is corrected enable reload register (7) 6 5 4 3 2 1 0 1 234 567 89101112 6 5 4 3 h'ffff 7 counter 3 correction register +3 interrupt underflow count value =(7+1)+(3+1)=12 (note 1) note 1: what you actually see in the cycle immediately after reload is the previous counter value, and not 7. note 2: this diagram does not show detail timing information. prescaler delay count clock
10 10-87 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) when writing to the correction register, be careful not to cause the counter to overflow. even when the counter overflows due to correction of counts, no interrupt is generated for the occurrence of overflow. in the example below, the reload register has the initial value h'8000 set in it. when the timer starts, the reload register value is loaded into the counter causing it to start counting down. in the example diagram here, h'4000 is written to the correction register when the counter has counted down to h'5000. as a result of this correction, the count has been increased to h'9000, so that the counter stops after counting a total of (h'8000 + 1 + h'4000 + 1) counts.
10 10-88 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.12 example of counting in top single-shot output mode when count is corrected h'ffff h'0000 indeterminate h'8000 write to correction register h'4000 h'5000 h'5000+h'4000 h'8000 h'ffff count clock correction register enabled (by writing to enable bit or by external input) f/f output disabled (by underflow) top interrupt due to underflow enable bit note: this diagram does not show detail timing information. reload register data inverted by enable counter data inverted by underflow
10 10-89 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) (3) precautions to be observed when using top single-shot output mode the following describes precautions to be observed when using top single-shot output mode. ? if the counter stops due to underflow in the same clock period as the timer is enabled by external input, the former has priority (so that the counter stops). ? if the counter stops due to underflow in the same clock period as count is enabled by writing to the enable bit, the latter has priority (so that count is enabled). ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? because the internal circuit operation is synchronized to the count clock (prescaler output), a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled. figure 10.3.13 prescaler delay ? when writing to the correction register, be careful not to cause the counter to overflow. even when the counter overflows due to correction of counts, no interrupt is generated for the occurrence of overflow. when the counter underflows in the subsequent down-count after overflow, a false underflow interrupt is generated due to overcounting. in the example below, the reload register has the initial value h'fff8 set in it. when the timer starts, the reload register value is loaded into the counter causing it to start counting down. in the example diagram here, h'0014 is written to the correction register when the counter has counted down to h'fff0. as a result of this correction, the count overflows to h'0004 and fails to count correctly. also, an interrupt is generated for an erroneous overcount. internal clock count clock enable f/f operation prescaler cycle delay till prescaler cycle write to enable bit ~ ~ ~ ~ ~ ~ ~ ~
10 10-90 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.14 example of operation in top single-shot output mode where count overflows due to correction h'ffff h'0000 indeterminate indeterminate h'fff8 write to correction register h'(fff0+0014) h'0004 h'fff0 h'0014 overflow occurs actual count after overflow h'fff8 h'ffff count clock correction register enabled (by writing to enable bit or by external input) f/f output disabled (by underflow) top interrupt due to underflow enable bit note: this diagram does not show detail timing information. reload register data inverted by enable counter data inverted by underflow
10 10-91 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.10 operation in top delayed single-shot output mode (with correction function) (1) outline of top delayed single-shot output mode in delayed single-shot output mode, the timer generates a pulse in width of (reload register set value + 1) only once, with the output delayed by an amount of time equal to (counter set value + 1) and then stops without performing any operation. when after setting the counter and reload register, the timer is enabled (by writing to the enable bit in software or by external input), it starts counting down from the counter's set value synchronously with the count clock. the first time the counter underflows, the reload register value is loaded into the counter causing it to continue counting down, and the counter stops when it underflows next time. the f/f output waveform in delayed single-shot output mode is inverted (f/f output levels change from low to high, or vice versa) when the counter underflows first time and next, generating a single-shot pulse waveform in width of (reload register set value + 1) only once, with the output delayed by an amount of time equal to (first set value of counter + 1). also, an interrupt can be generated when the counter underflows first time and next. the valid count values are the (counter set value + 1) and (reload register set value + 1). the diagram below shows timer operation as an example when the initial counter value = 4 and the initial reload register value = 5. figure 10.3.15 example of counting in top delayed single-shot output mode enable reload register (4) 3 2 1 12345678 h'ffff 5 counter interrupt underflow count value =(4+1)+(5+1)=11 (note 1) f/f output 91 0 1 1 0 3 2 1 0 4 (5) (note 2) h'ffff underflow prescaler delay count clock note 1: what you actually see in the cycle immediately after enable is the previous counter value, and not 4. note 2: what you actually see in the cycle immediately after reload is h'ffff (underflow value), and not 5. note 3: this diagram does not show detail timing information.
10 10-92 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) in the example below, the counter has the initial value h'a000 set in it and the reload register has the initial value h'f000 set in it. when the timer starts, the counter starts counting down clock pulses and when it underflows after reaching the minimum count, the counter is reloaded with the content of the reload register. then when the counter underflows next time while continuing down- count, it stops. figure 10.3.16 typical operation in top delayed single-shot output aaaaaaaaaaaaaa correction register h'ffff h'0000 underflow (first time) down-count starting from counter's set value h'a000 underflow (second time) h'f000 down-count starting from reload register's set value h'(f000-1) data inverted by underflow (not used) h'ffff h'f000 count clock enabled (by writing to enable bit or by external input) f/f output top interrupt due to underflow enable bit note: this diagram does not show detail timing information. reload register counter data inverted by underflow
10 10-93 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) (2) correction function of top delayed single-shot output mode if you want to change the counter value during operation, write a value to the top correction register, the value by which you want to be increased or reduced from the initial count set in the counter. to add, write the value you want to add to the correction register directly as is; to subtract, write the two's complement of the value you want to subtract to the correction register. correction of the counter is performed synchronously with a clock period next to the one in which the correction value was written to the top correction register. in this case, one down-count in the clock period during which the correction was performed is canceled. therefore, note that the counter value actually is corrected by (correction register value + 1). for example, if the initial counter value is 7 and you write a value 3 to the correction register when the counter has counted down to 3, then the counter underflows after a total of 12 counts after reload. figure 10.3.17 example of counting in top delayed single-shot output mode when count is corrected when writing to the correction register, be careful not to cause the counter to overflow. even when the counter overflows due to correction of counts, no interrupt is generated for the occurrence of overflow. enable = "h" reload register (7) 6 5 4 3 2 1 0 1 234 567 89101112 6 5 4 3 h'ffff 7 counter 3 correction register + 3 interrupt underflow count value after reload =(7+1)+(3+1)=12 (note 1) 0 count clock note 1: what you actually see in the cycle immediately after reload is the previous counter value, and not 7. note 2: this diagram does not show detail timing information.
10 10-94 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) figure 10.3.18 typical operation in top delayed single-shot output mode when correction applied h'ffff h'0000 underflow (first time) indeterminate counter corrected h'f000 h'a000 underflow (second time) h'f000 h'(f000+0008+1) h'0008 write to correction register correction register data inverted by underflow count clock f/f output top interrupt due to underflow enable bit reload register counter data inverted by underflow note: this diagram does not show detail timing information.
10 10-95 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) (3) precautions to be observed when using top delayed single-shot output mode the following describes precautions to be observed when using top delayed single-shot output mode. ? if the counter stops due to underflow in the same clock period as the timer is enabled by external input, the former has priority (so that the counter stops). ? if the counter stops due to underflow in the same clock period as count is enabled by writing to the enable bit, the latter has priority (so that count is enabled). ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? even when the counter overflows due to correction of counts, no interrupt is generated for the occurrence of overflow. when the counter underflows in the subsequent down-count after overflow, a false underflow interrupt is generated due to overcounting. ? when you read the counter immediately after reloading it pursuant to underflow, the value you get is temporarily h'ffff. but this counter value immediately changes to (reload value - 1) at the next clock edge. figure 10.3.19 counter value immediately after underflow count clock enable bit "h" h'0001 h'0000 h'ffff h'aaa9 h'aaa8 counter value h'aaaa reload register reload due to underflow h'(aaaa-1) h'(aaaa-2) during reload cycle, you always see h'ffff, and not the reload register value (in this case, h'aaaa). down-count starting from reloaded register value reload cycle
10 10-96 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) 10.3.11 operation in top continuous output mode (without correction function) (1) outline of top continuous output mode in continuous output mode, the timer counts down clock pulses starting from the set value of the counter and when the counter underflows, reloads it with the reload register value. thereafter, this operation is repeated each time the counter underflows, thus generating consecutive pulses whose waveform is inverted in width of (reload register set value + 1). when after setting the counter and reload register, the timer is enabled (by writing to the enable bit in software or by external input), it starts counting down from the counter's set value synchronously with the count clock and when the minimum count is reached, generates an underflow. this underflow causes the counter to be reloaded with the content of the reload register and start counting over again. thereafter, this operation is repeated each time an underflow occurs. to stop the counter, disable count by writing to the enable bit in software. the f/f output waveform in continuous output mode is inverted (f/f output levels change from low to high, or vice versa) at startup and upon underflow, generating consecutive pulses until the timer stops counting. also, an interrupt can be generated each time the counter underflows.
10 10-97 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) the valid count values are the (counter set value + 1) and (reload register set value + 1). the diagram below shows timer operation as an example when the initial counter value = 4 and the initial reload register value = 5. note 1: what you actually see in the cycle immediately after enable is the previous counter value, and not 4. note 2: what you actually see in the cycle immediately after reload is h'ffff (underflow value), and not 5. note 3: this diagram does not show detail timing information. figure 10.3.20 example of counting in top continuous output mode (4) 3 2 1 12345 h'ffff count value =5 0 3 2 1 0 4 (5) 3 2 1 0 (5) (5) 4 5 123456 count value =6 count value =6 123456 enable reload register counter interrupt (note 1) f/f output underflow prescaler delay count clock (note 2) (note 2) (note 2) underflow underflow
10 10-98 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) in the example below, the counter has the initial value h'a000 set in it and the reload register has the initial value h'e000 set in it. when the timer starts, the counter starts counting down clock pulses and when it underflows after reaching the minimum count, the counter is reloaded with the content of the reload register and continues counting down. figure 10.3.21 typical operation in top continuous output mode aaaaaaaaaaaaaa aaaaaaaaaaaaaa h'ffff h'0000 h'e000 h'a000 h'e000 h'(e000-1) data inverted by enable h'(e000-1) h'ffff h'ffff correction register underflow (first time) down-count starting from counter's set value underflow (second time) down-count starting from reload register set value data inverted by underflow (not used) count clock enabled (by writing to enable bit or by external input) f/f output top interrupt due to underflow enable bit note: this diagram does not show detail timing information. reload register counter down-count starting from reload register set value data inverted by underflow
10 10-99 ver.0.10 multijunction timers 10.3 top (output-related 16-bit timer) (2) precautions to be observed when using top continuous output mode the following describes precautions to be observed when using top continuous output mode. ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? when you read the counter immediately after reloading it pursuant to underflow, the value you get is temporarily h'ffff. but this counter value immediately changes to (reload value - 1) at the next clock edge. ? because the internal circuit operation is synchronized to the count clock (prescaler output), a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled. figure 10.3.22 prescaler delay internal clock count clock enable f/f operation prescaler cycle delay till prescaler cycle write to enable bit ~ ~ ~ ~ ~ ~ ~ ~
10 10-100 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4 tio (input/output-related 16-bit timer) 10.4.1 outline of tio tio (timer input/output) is an input/output-related 16-bit timer, whose operation mode can be selected from the following by mode switching in software: ? measure clear input mode ? measure free-run input mode ? nose processing input mode ? pwm output mode ? single-shot output mode ? delayed single-shot output mode ? continuous output mode the table below shows specifications of tio. the diagram in the next page shows a block diagram of tio. table 10.4.1 specifications of tio (input/output-related 16-bit timer) item specification number of channels 10 channels counter 16-bit down-counter reload register 16-bit reload register measure register 16-bit capture register timer startup started by writing to enable bit in software or by enabling with external input (rising/falling edge or both or high/low level) mode selection ? measure clear input mode ? measure free-run input mode ? nose processing input mode ? pwm output mode ? single-shot output mode ? delayed single-shot output mode ? continuous output mode interrupt generation can be generated by a counter underflow
10 10-101 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.1 block diagram of tio (input/output-related 16-bit timer) irq12 irq12 irq12 3 2 1 0 1/2 internal clock irq8 tin7 tclk1 clk en/cap udf tio 0 clk en/cap udf tio 1 clk en/cap udf tio 2 clk en/cap udf tio 3 clk en/cap udf tio 4 s s tin3s tin3 s s tin4s tin4 tin5s tin5 s s irq12 tin6s tin6 psc1 psc0 clk en/cap udf tio 5 s tclk1s s tin7s irq8 tin8 tclk2 clk en/cap udf tio 6 s tclk2s s tin8s irq8 tin9 clk en/cap udf tio 7 s s tin9s irq8 tin10 s s tin10s clk en/cap udf tio 8 clk en/cap udf tio 9 irq8 tin11 s s tin11s f/f11 f/f12 f/f13 f/f14 f/f15 s f/f16 f/f17 f/f18 f/f19 s f/f psc0 2 : prescaler s s s s s s s s s to 11 to 12 to 13 to 14 to 15 irq0 irq0 irq0 irq0 irq4 to 16 to 17 to 18 to 19 to 20 irq4 irq4 irq4 drq0 irq3 3 2 1 0 0 1 2 3 0 1 2 3 3 2 1 0 3 2 1 0 psc2 irq3 note: reload 1 register is used in only pwm output mode. f/f20 drq10 drq11 clock bus input event bus output event bus reload 0/measure register down-counter reload 1 register (note) (16 bits) : selector : output flip-flop ~
10 10-102 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.2 outline of each mode of tio each mode of tio is outlined below. for each tio channel, only one of the following modes can be selected. (1) measure clear/free-run input modes in measure clear/free-run input modes, the timer measures a duration of time from when it starts counting till when an external capture signal is entered. after the timer is enabled (by writing to the enable bit in software), the counter starts counting down synchronously with the count clock. when a capture signal is entered from an external device, the counter value at that point in time is written to a register called the "measure register." especially in measure clear input mode, the counter value is initialized to h'ffff upon capture, from which the counter starts counting down again. in measure free-run mode, the counter continues counting down even after capture and upon underflow, recycles to h'ffff, from which it starts counting down again. to stop the counter, disable count by writing to the enable bit in software. note that an interrupt can be generated by a counter underflow or execution of measure operation. (2) noise processing input mode in noise processing input mode, the timer detects the status of an input signal that it remained in the same state for over a predetermined time. in noise processing input mode, the counter is started by entering a high or low-level signal from an external device and if the signal remains in the same state for over a predetermined time before the counter underflows, the counter stops after generating an interrupt. if the valid-level signal being applied turns to an invalid level before the counter underflows, the counter temporarily stops counting and when a valid-level signal is entered again, it is reloaded with the initial count and restarts counting. the timer stops at the same time the counter underflows or count is disabled by writing to the enable bit. an interrupt can be generated by a counter underflow. (3) pwm output mode (without correction function) in pwm output mode, the timer uses two reload registers to generate a waveform with a given duty cycle.
10 10-103 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) when after setting the initial values in reload 0 and reload 1 registers, the timer is enabled (by writing to the enable bit in software or by external input), it loads the reload 0 register value into the counter synchronously with the count clock letting the counter start counting down. the first time the counter underflows, the reload 1 register value is loaded into the counter letting it continue counting. thereafter, the counter is reloaded with the reload 0 and reload 1 register values alternately each time an underflow occurs. the f/f output waveform in pwm output mode is inverted at count startup and upon each underflow. the timer stops at the same time count is disabled by writing to the enable bit (and not in synchronism with pwm output period). an interrupt can be generated when the counter underflows every other time (second time, fourth time, and so on) after being enabled. (4) single-shot output mode (without correction function) in single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once and stops without performing any operation. when after setting the reload 0 register, the timer is enabled (by writing to the enable bit in software or by external input), it loads the content of reload 0 register into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clock pulses and stops when it underflows after reaching the minimum count. the f/f output waveform in single-shot output mode is inverted at startup and upon underflow, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once. also, an interrupt can be generated when the counter underflows. (5) delayed single-shot output mode (without correction function) in delayed single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once, with the output delayed by an amount of time equal to (counter set value + 1) and then stops without performing any operation. when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by external input), it starts counting down from the counter's set value synchronously with the count clock. the first time the counter underflows, the reload 0 register value is loaded into the counter causing it to continue counting down, and the counter stops when it underflows next time. the f/f output waveform in delayed single-shot output mode is inverted when the counter underflows first time and next, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once, with the output delayed by an amount of time equal to (first set value of counter + 1). also, an interrupt can be generated when the counter underflows first time and next.
10 10-104 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) (6) continuous output mode (without correction function) in continuous output mode, the timer counts down clock pulses starting from the set value of the counter and when the counter underflows, reloads it with the reload 0 register value. thereafter, this operation is repeated each time the counter underflows, thus generating consecutive pulses in width of (reload 0 register set value + 1). when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by external input), it starts counting down from the counter's set value synchronously with the count clock and when the minimum count is reached, generates an underflow. this underflow causes the counter to be reloaded with the content of reload 0 register and start counting over again. thereafter, this operation is repeated each time an underflow occurs. to stop the counter, disable count by writing to the enable bit in software. the f/f output waveform in continuous output mode is inverted at startup and upon underflow, generating consecutive pulses until the timer stops counting. also, an interrupt can be generated each time the counter underflows.
10 10-105 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.3 tio related register map the diagram below shows a tio related register map. figure 10.4.2 tio related register map (1/3) h'0080 0300 d0 d7 +0 address +1 address d8 d15 h'0080 0302 h'0080 0304 h'0080 0306 h'0080 0310 h'0080 0312 h'0080 0314 h'0080 0316 h'0080 0320 h'0080 0322 h'0080 0324 h'0080 0326 h'0080 0330 h'0080 0332 h'0080 0334 h'0080 0336 tio0 reload 0/ measure register (tio0rl0) h'0080 0318 h'0080 031a h'0080 031c tio0-3 control register 0 (tio03cr0) tio0-3 control register 1 (tio03cr1) address tio0 counter (tio0ct) tio0 reload 1 register (tio0rl) note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. tio1 reload 0/ measure register (tio1rl0) tio1 counter (tio1ct) tio1 reload 1 register (tio1rl) tio2 reload 0/ measure register (tio0rl2) tio2 counter (tio2ct) tio2 reload 2 register (tio2rl) tio3 reload 0/ measure register (tio3rl0) tio3 counter (tio3ct) tio3 reload 2 register (tio3rl)
10 10-106 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.3 tio related register map (2/3) h'0080 0340 d0 d7 d8 d15 h'0080 0342 h'0080 0344 h'0080 0346 h'0080 0350 h'0080 0352 h'0080 0354 h'0080 0356 h'0080 0360 h'0080 0362 h'0080 0364 h'0080 0366 h'0080 0370 h'0080 0372 h'0080 0374 h'0080 0376 h'0080 034a h'0080 0348 tio4 control register (tio4cr) h'0080 036a h'0080 0368 +0 address +1 address tio4 reload 0/ measure register (tio4rl0) tio5 control register (tio5cr) address tio4 counter (tio4ct) tio4 reload 1 register (tio4rl) blank addresses are reserved. tio5 reload 0/ measure register (tio5rl0) tio5 counter (tio5ct) tio5 reload 1 register (tio5rl) tio6 reload 0/ measure register (tio6rl0) tio6 counter (tio6ct) tio6 reload 1 register (tio6rl) tio6 control register (tio6cr) tio7 control register (tio7cr) tio7 reload 0/ measure register (tio7rl0) tio7 counter (tio7ct) tio7 reload 1 register (tio7rl)
10 10-107 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.4 tio related register map (3/3) h'0080 0380 d0 d7 d8 d15 h'0080 0382 h'0080 0384 h'0080 0386 h'0080 0390 h'0080 0392 h'0080 0394 h'0080 0396 h'0080 03bc h'0080 03be h'0080 038a h'0080 0388 +0 address +1 address tio8 reload 0/ measure register (tio8rl0) tio9 control register (tio9cr) address tio8 counter (tio8ct) tio8 reload 1 register (tio8rl) note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. tio8 control register (tio8cr) tio9 reload 0/ measure register (tio9rl0) tio9 counter (tio9ct) tio9 reload 1 register (tio9rl1) tio0-9 enable protect register (tiopro) tio0-9 count enable register (tiocen)
10 10-108 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.4 tio control registers the tio control registers are used to select tio0-9 operation modes (measure input, noise processing input, pwm output, single-shot output, delayed single-shot output, or continuous output mode), as well as select the counter enable and counter clock sources. following eight tio control registers are provided for each timer group. ? tio0-3 control register 0 (tio03cr0) ? tio0-3 control register 1 (tio03cr1) ? tio4 control register (tio4cr) ? tio5 control register (tio5cr) ? tio6 control register (tio6cr) ? tio7 control register (tio7cr) ? tio8 control register (tio8cr) ? tio9 control register (tio9cr)
10 10-109 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) d bit name function r w 0 tio3een (tio3 external input enable) 0: disables external input (note 2) 1: enables external input 1-3 tio3m (tio3 operation mode selection) 000: single-shot output mode 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode 4 tio2ens (tio2 enable/ 0: no selection measure input source selection) 1: external input tin5 5-7 tio2m 000: single-shot output mode (tio2 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode 8 tio1ens (tio1 enable/ 0: no selection measure input source selection) 1: external input tin4 n tio0-3 control register 0 (tio3cr0) note 1: to select the tio3 enable/measure input source, use the tio4 control register's tio34ens (tio3, tio4 enable/measure input source selection) bit. note 2: during measure free-run/clear input mode, even if this bit is set to 0 (external input disabled), when a capture signal is entered from an external device, the counter value at that point in time is written to the measure register. however, because in measure clear input mode, if this bit = 0 (external input disabled), the counter value is not initialized (h'ffff) upon capture, we recommend that this bit be set to 1 (external input enabled) when using measure clear input mode. note 3: this register must always be accessed in halfwords. note 4: always make sure the counter has stopped and is idle before setting or changing operation modes. tio3 tio2 tio1 tio0 een ens ens ens d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tio3m tio2m tio1m tio0m (continues to the next page)
10 10-110 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) (continued from the preceding page) note 3: this register must always be accessed in halfwords. note 4: always make sure the counter has stopped and is idle before setting or changing operation modes. figure 10.4.5 outline diagram of tio0-4 clock/enable inputs d bit name function r w 9-11 tio1m 000: single-shot output mode (tio1 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode 12 tio0ens (tio0 enable/ 0: no selection measure input source selection) 1: external input tin3 13-15 tio0m 000: single-shot output mode (tio0 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode clock bus input event bus 3 2 1 0 clk en/cap tio 0 clk en/cap tio 1 clk en/cap tio 2 clk en/cap tio 3 clk en/cap tio 4 s s tin3s tin3 s s tin4s tin4 tin5s tin5 s s tin6s tin6 s : selector 3 2 1 0 3 2 1 0 3 2 1 0 note: this diagram is shown for the explanation of tio control registers, and is partly omitted.
10 10-111 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) n tio0-3 control register 1 (tio03cr1) d bit name function r w 8-13 no functions assigned 0 C 14,15 tio03cks 00: clock bus 0 (tio0-3 clock source selection) 01: clock bus 1 10: clock bus 2 11: clock bus 3 d8 9 1011121314d15 tio03cks
10 10-112 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) n tio4 control register (tio4cr) note 1: during measure free-run/clear input mode, even if this bit is set to 0 (external input disabled), when a capture signal is entered from an external device, the counter value at that point in time is written to the measure register. however, because in measure clear input mode, if this bit = 0 (external input disabled), the counter value is not initialized (h'ffff) upon capture, we recommend that this bit be set to 1 (external input enabled) when using measure clear input mode. note 2: always make sure the counter has stopped and is idle before setting or changing operation modes. d0123456d7 tio4cks tio4een tio34ens tio4m d bit name function r w 0, 1 tio4cks 00: clock bus 0 (tio4 clock source selection) 01: clock bus 1 10: clock bus 2 11: clock bus 3 2 tio4een (note 1) 0: disables external input (tio4 external input enable) 1: enables external input 3,4 tio34ens 0x: external input tin6 (tio3,4 enable/measure 10: input event bus 2 input source selection) 11: input event bus 3 5-7 tio4m 000: single-shot output mode (tio4 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode
10 10-113 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.6 outline diagram of tio5-9 clock/enable inputs clk en/cap s tclk2s s tin8s 3 2 1 0 tin7 tclk1 clk en/cap tio 5 s tclk1s s tin7s tin8 tclk2 tio 6 tin9 clk en/cap tio 7 s s tin9s tin10 s s tin10s clk en/cap tio 8 clk en/cap tio 9 tin11 s s tin11s s 3 2 1 0 3 2 1 0 3 2 1 0 clock bus input event bus : selector note: this is an outline diagram shown for the explanation of tio control register
10 10-114 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) n tio5 control register (tio5cr) note: always make sure the counter has stopped and is idle before setting or changing operation modes. d bit name function r w 8-10 tio5cks 0xx: external input tclk1 (tio5 clock source selection) 100: clock bus 0 101: clock bus 1 110: clock bus 2 111: clock bus 3 11,12 tio5ens 0x: no selection (tio5 enable/measure 10: external input tin7 input source selection) 11: input event bus 3 13-15 tio5m 000: single-shot output mode (tio5 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode d8 9 1011121314d15 tio5cks tio5ens tio5m
10 10-115 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) n tio6 control register (tio6cr) note: always make sure the counter has stopped and is idle before setting or changing operation modes. d0123456d7 tio6cks tio6ens tio6m d bit name function r w 0-2 tio6cks 0xx: external input tclk2 (tio6 clock source selection) 100: clock bus 0 101: clock bus 1 110: clock bus 2 111: clock bus 3 3,4 tio6ens 00: no selection (tio6 enable/measure 01: external input tin8 input source selection) 10: input event bus 2 11: input event bus 3 5-7 tio6m 000: single-shot output mode (tio6 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode
10 10-116 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) n tio7 control register (tio7cr) note: always make sure the counter has stopped and is idle before setting or changing operation modes. d bit name function r w 8 no functions assigned 0 C 9,10 tio7cks 00: clock bus 0 (tio7 clock source selection) 01: clock bus 1 10: clock bus 2 11: clock bus 3 11,12 tio7ens 00: no selection (tio7 enable/measure 01: external input tin9 input source selection) 10: input event bus 0 11: input event bus 3 13-15 tio7m 000: single-shot output mode (tio7 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode d8 9 1011121314d15 tio7cks tio7ens tio7m
10 10-117 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) n tio8 control register (tio8cr) note: always make sure the counter has stopped and is idle before setting or changing operation modes. d bit name function r w 0,1 tio8cks 00: clock bus 0 (tio8 clock source selection) 01: clock bus 1 10: clock bus 2 11: clock bus 3 2-4 tio8ens 0xx: no selection (tio8 enable/measure 100: external input tin10 input source selection) 101: input event bus 1 110: input event bus 2 111: input event bus 3 5-7 tio8m 000: single-shot output mode (tio8 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode d0123456d7 tio8cks tio8ens tio8m
10 10-118 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) n tio9 control register (tio9cr) note: always make sure the counter has stopped and is idle before setting or changing operation modes. d bit name function r w 8 no functions assigned 0 C 9,10 tio9cks 00: clock bus 0 (tio9 clock source selection) 01: clock bus 1 10: clock bus 2 11: clock bus 3 11,12 tio9ens 00: no selection (tio9 enable/measure 01: external input tin1 input source selection) 10: input event bus 1 11: input event bus 3 13-15 tio9m 000: single-shot output mode (tio9 operation mode selection) 001: delayed single-shot output mode 010: continuous output mode 011: pwm output mode 100: measure clear input mode 101: measure free-run input mode 11x: noise processing input mode d8 9 1011121314d15 tio9cks tio9ens tio9m
10 10-119 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) d bit name function r w 0-15 tio0ct-tio9ct 16-bit counter value 10.4.5 tio counter (tio0ct-tio9ct) n tio0 counter (tio0ct) n tio1 counter (tio1ct) n tio2 counter (tio2ct) n tio3 counter (tio3ct) n tio4 counter (tio4ct) n tio5 counter (tio5ct) n tio6 counter (tio6ct) n tio7 counter (tio7ct) n tio8 counter (tio8ct) n tio9 counter (tio9ct) w= : write to this register is not accepted is disabled in pwm output mode. note: this register must always be accessed in halfwords. the tio counters are a 16-bit down-counter. after the timer is enabled (by writing to the enable bit in software or by external input), the counter starts counting synchronously with the count clock. the counter cannot be written to during pwm output mode. d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tio0ct-tio9ct
10 10-120 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) d bit name function r w 0-15 tio0rl0-tio9rl0 16-bit reload register value 10.4.6 tio reload 0/ measure register (tio0rl0-tio9rl0) n tio0 reload 0/ measure register (tio0rl0) n tio1 reload 0/ measure register (tio1rl0) n tio2 reload 0/ measure register (tio2rl0) n tio3 reload 0/ measure register (tio3rl0) n tio4 reload 0/ measure register (tio4rl0) n tio5 reload 0/ measure register (tio5rl0) n tio6 reload 0/ measure register (tio6rl0) n tio7 reload 0/ measure register (tio7rl0) n tio8 reload 0/ measure register (tio8rl0) n tio9 reload 0/ measure register (tio9rl0) d01234567891011121314d15 tio0rl0-tio9rl0 w= : write to this register is not accepted is disabled in pwm output mode. note: this register must always be accessed in halfwords. the tio reload 0/ measure registers serve dual purposes as a register for reloading tio count registers (tio0ct-tio9ct) with data, and as a measure register during measure input mode. these registers are disabled against write during measure input mode. it is in the following cases that the content of reload 0 register is loaded into the counter: ? when after the counter started counting in noise processing input mode, the input signal is inverted and a valid-level signal is entered again before the counter underflows ? when the counter is enabled in single-shot mode ? when the counter underflowed in delayed single-shot or continuous mode ? when the counter is enabled in pwm mode and when the counter value set by reload 1 register underflowed writing data to the reload 0 register does not mean that the data is loaded into the counter simultaneously. when used as a measure register, the counter value is latched into the measure register by an event input.
10 10-121 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) d bit name function r w 0-15 tio0rl1-tio9rl1 16-bit reload register value 10.4.7 tio reload 1 registers (tio0rl1-tio9rl1) n tio0 reload 1 register (tio0rl1) n tio1 reload 1 register (tio1rl1) n tio2 reload 1 register (tio2rl1) n tio3 reload 1 register (tio3rl1) n tio4 reload 1 register (tio4rl1) n tio5 reload 1 register (tio5rl1) n tio6 reload 1 register (tio6rl1) n tio7 reload 1 register (tio7rl1) n tio8 reload 1 register (tio8rl1) n tio9 reload 1 register (tio9rl1) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tio0rl1-tio9rl1 note: this register must always be accessed in halfwords. the tio reload 1 registers are used to reload the tio counter registers (tio0ct-tio9ct) with data. it is in the following cases that the content of reload 1 register is loaded into the counter: ? when the count value set by reload 0 register underflowed in pwm output mode writing data to the reload 1 register does not mean that the data is loaded into the counter simultaneously.
10 10-122 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) d bit name function r w 0-5 no functions assigned 0 C 6 tio9pro (tio9 enable protect) 0: enables rewrite 7 tio8pro (tio8 enable protect) 1: disables rewrite 8 tio7pro (tio7 enable protect) 9 tio6pro (tio6 enable protect) 10 tio5pro (tio5 enable protect) 11 tio4pro (tio4 enable protect) 12 tio3pro (tio3 enable protect) 13 tio2pro (tio2 enable protect) 14 tio1pro (tio1 enable protect) 15 tio0pro (tio0 enable protect) 10.4.8 tio enable control registers n tio0-9 enable protect register (tiopro) note: this register must always be accessed in halfwords. the tio0-9 enable protect register controls rewriting of the tio count enable bit described in the next page by enabling or disabling rewrite. d01234567891011121314d15 tio9 tio8 tio7 tio6 tio5 tio4 tio3 tio2 tio1 tio0 pro pro pro pro pro pro pro pro pro pro
10 10-123 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) d bit name function r w 0-5 no functions assigned 0 C 6 tio9cen (tio9 count enable) 0: stops count 7 tio8cen (tio8 count enable) 1: enables count 8 tio7cen (tio7 count enable) 9 tio6cen (tio6 count enable) 10 tio5cen (tio5 count enable) 11 tio4cen (tio4 count enable) 12 tio3cen (tio3 count enable) 13 tio2cen (tio2 count enable) 14 tio1cen (tio1 count enable) 15 tio0cen (tio0 count enable) n tio0-9 count enable register (tiocen) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tio9 tio8 tio7 tio6 tio5 tio4 tio3 tio2 tio1 tio0 cen cen cen cen cen cen cen cen cen cen note: this register must always be accessed in halfwords. the tio0-9 count enable register controls operation of tio counters. to enable the counter in software, enable the relevant tio0-9 enable protect register for write and set the count enable bit by writing a 1. to stop the counter, enable the tio0-9 enable protect register for write and reset the count enable bit by writing a 0. in all but continuous mode, when the counter stops due to an occurrence of underflow, the count enable bit is automatically reset to 0. therefore, what you get by reading the tio0-9 count enable register is the status that indicates the counter's operating status (active or idle).
10 10-124 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.7 configuration of the tio enable circuit wr dn tiom enable protect (tiompro) wr en-on tiom external enable (tiomeen or tiomens) tinns tiom enable (tiomcen) tio enable control edge selection f/f f/f f/f event bus
10 10-125 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.9 operation in tio measure free-run/clear input modes (1) outline of tio measure free-run/clear input modes in tio measure free-run/clear input modes, the timer measures a duration of time from when it starts counting till when an external capture signal is entered. an interrupt can be generated by a counter underflow or execution of measure operation. after the timer is enabled (by writing to the enable bit in software), the counter starts counting down synchronously with the count clock. when a capture signal is entered from an external device, the counter value at that point in time is written to the measure register. especially in measure clear input mode, the counter value is initialized to h'ffff upon capture, from which the counter starts counting down again. when the counter underflows after reaching the minimum count, it starts counting down from h'ffff again. in measure free-run input mode, the counter continues counting down even after capture and upon underflow, recycles to h'ffff, from which it starts counting down again. to stop the counter, disable count by writing to the enable bit in software.
10 10-126 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.8 typical operation in measure free-run input mode count clock counter h'ffff h'0000 enabled (by writing to enable bit) tio interrupt measure event (capture) occurs indeterminate enable bit note: this diagram does not show detail timing information. measure register h'7000 tin interrupt by external event input tio interrupt by underflow h'9000 h'7000 h'9000 measure event (capture) occurs tin interrupt by external event input tin interrupt
10 10-127 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.9 typical operation in measure clear input mode h'ffff h'0000 h'7000 h'7000 count clock counter enabled (by writing to enable bit) tio interrupt measure event (capture) occurs indeterminate enable bit note: this diagram does not show detail timing information. measure register tin interrupt by external event input tio interrupt by underflow tin interrupt
10 10-128 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) (2) precautions to be observed when using tio measure free-run/clear input modes the following describes precautions to be observed when using tio measure free-run/clear input modes. ? if measure event input and write to the counter occur simultaneously in the same clock period, the write value is set in the counter while at the same time latched into the measure register.
10 10-129 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.10 operation in tio noise processing input mode in noise processing input mode, the timer detects the status of an input signal that it remained in the same state for over a predetermined time. in noise processing input mode, the counter is started by entering a high or low-level signal from an external device and if the signal remains in the same state for over a predetermined time before the counter underflows, the counter stops after generating an interrupt. if the valid-level signal being applied turns to an invalid level before the counter underflows, the counter temporarily stops counting and when a valid-level signal is entered again, it is reloaded with the initial count and restarts counting. the valid count value is (reload 0 register set value + 1). the timer stops at the same time the counter underflows or count is disabled by writing to the enable bit. an interrupt can be generated by a counter underflow. figure 10.4.10 typical operation in noise processing input mode h'ffff h'0000 enabled (by writing to enable bit or by external input) reload 0 register h'a000 external input (noise processing) h'a000 valid signal width invalid invalid disabled by underflow count clock counter tio interrupt enable bit note: this diagram does not show detail timing information. tio interrupt by underflow
10 10-130 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.11 operation in tio pwm output mode (1) outline of tio pwm output mode in pwm output mode, the timer uses two reload registers to generate a waveform with a given duty cycle. when after setting the initial values in reload 0 and reload 1 registers, the timer is enabled (by writing to the enable bit in software or by external input), it loads the reload 0 register value into the counter synchronously with the count clock letting the counter start counting down. the first time the counter underflows, the reload 1 register value is loaded into the counter letting it continue counting. thereafter, the counter is reloaded with the reload 0 and reload 1 register values alternately each time an underflow occurs. the valid count values are (reload 0 register set value + 1) and (reload 1 register set value + 1). the timer stops at the same time count is disabled by writing to the enable bit (and not in synchronism with pwm output period). the f/f output waveform in pwm output mode is inverted (f/f output levels change from low to high, or vice versa) at count startup and upon each underflow. an interrupt can be generated when the counter underflows every other time (second time, fourth time, and so on) after being enabled. note that tio's pwm output mode does not have the correction function.
10 10-131 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.11 typical operation in pwm output mode h'ffff h'0000 f/f output underflow (first time) tio interrupt by underflow h'a000 underflow (second time) down-count starting from reload 1 register set value h'(c000-1) data inverted by underflow data inverted by enable h'(a000-1) reload 1 register h'c000 down-count starting from reload 0 register set value down-count starting from reload 0 register set value h'a000 pwm output period h'c000 h'a000 enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. data inverted by underflow
10 10-132 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) (2) reload register updates in tio pwm output mode in pwm output mode, when the timer remains idle, reload 0 and reload 1 registers are updated at the same time data are written to the registers. but when the timer is active, reload 1 register is updated by updating reload 0 register. however, when you read reload 0 and reload 1 registers, the values you get are always the data written to the registers. figure 10.4.12 pwm circuit diagram if you want to rewrite reload 0 and reload 1 registers while the timer is operating, rewrite reload 1 register first and then reload 0 register. in this way, reload 0 and reload 1 registers both are updated synchronously with pwm periods, from which the timer starts operating again. this operation can normally be performed collectively by accessing register addresses wordwise (in 32 bits) beginning with that of reload 1 register. (data are automatically written to reload 1 and then reload 0 registers in succession.) if you update the reload registers in reverse by updating reload 0 register first and then reload 1 register, only reload 0 register is updated. when you read reload 0 and reload 1 registers, the values you get are always the data written to the registers, and not the reload values being actually used. note that when updating the pwm period, if the pwm period is terminated before you finished writing to reload 0, the pwm period is not updated in the current period and what you've set is reflected in the next period. internal bus tionrl1 reload 1 reload1wr reload0wr buffer 16-bit counter prescaler output f/f to tionrl0 reload 1 pwm mode control
10 10-133 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.13 reload 0 and reload 1 register updates in pwm output mode (a) when reload register updates take effect in the current period (reflected in the next period) aaaa note: this diagram does not show detail timing information. count clock reload 0 register reload 1 register h'0001 h'ffff h'1000 h'7fff h'2000 h'8000 h'9000 counter interrupt by underflow timing at which reload 1 and reload 0 registers are updated new pwm output period operation by new reload value written reload 0 register reload 1 register f/f output write to reload 1 write to reload 0 (reload 1 data latched) h'1000 h'2000 h'8000 h'9000 enlarged view new pwm output period old pwm output period f/f output h'7ffe h'0000 pwm period latched reload 1 buffer h'2000 h'9000 h'000 1 h' ffff h'1000 h'0fff h'2000 h'800 0 h'9000 (b) when reload register updates take effect in the next period (reflected one period later) h'1000 h'2000 h'8000 h'9000 h'0ffe h'000 0 h'2000 h'9000 note: this diagram does not show detail timing information. count clock reload 0 register reload 1 register counter interrupt by underflow timing at which reload 1 and reload 0 registers are updated old pwm output period operation by old reload value reload 0 register reload 1 register f/f output write to reload 1 write to reload 0 (reload 1 data latched) enlarged view old pwm output period old pwm output period f/f output pwm period latched reload 1 buffer
10 10-134 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.12 operation in tio single-shot output mode (without correction function) (1) outline of tio single-shot output mode in single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once and stops without performing any operation. when after setting the reload 0 register, the timer is enabled (by writing to the enable bit in software or by external input), it loads the content of reload 0 register into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clock pulses and stops when it underflows after reaching the minimum count. the f/f output waveform in single-shot output mode is inverted (f/f output levels change from low to high, or vice versa) at startup and upon underflow, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once. also, an interrupt can be generated when the counter underflows. the count value is (reload 0 register set value + 1). (for details about count operation, also refer to section 10.3.9, "operation in top single-shot output mode (with correction function)." (2) precautions to be observed when using tio single-shot output mode the following describes precautions to be observed when using tio single-shot output mode. ? if the counter stops due to underflow in the same clock period as the timer is enabled by external input, the former has priority (so that the counter stops). ? if the counter stops due to underflow in the same clock period as count is enabled by writing to the enable bit, the latter has priority (so that count is enabled). ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? because the internal circuit operation is synchronized to the count clock (prescaler output), a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled.
10 10-135 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.14 typical operation in tio single-shot output mode (without correction function) aaaaaaaaaaaa h'ffff h'0000 disabled (by underflow) (not used) counts down starting from reload 0 register set value h'a000 h'a000 f/f output tio interrupt by underflow data inverted by underflow data inverted by enable reload 1 register enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information.
10 10-136 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.13 operation in tio delayed single-shot output mode (without correction function) (1) outline of tio delayed single-shot output mode in delayed single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once, with the output delayed by an amount of time equal to (counter set value + 1) and then stops without performing any operation. when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by external input), it starts counting down from the counter's set value synchronously with the count clock. the first time the counter underflows, the reload 0 register value is loaded into the counter causing it to continue counting down, and the counter stops when it underflows next time. the f/f output waveform in delayed single-shot output mode is inverted (f/f output levels change from low to high, or vice versa) when the counter underflows first time and next, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once, with the output delayed by an amount of time equal to (first set value of counter + 1). also, an interrupt can be generated when the counter underflows first time and next. the valid count values are the (counter set value + 1) and (reload 0 register set value + 1). for details about count operation, also see section 10.3.10, "operation in top delayed single-shot output mode (with correction function)." (2) precautions to be observed when using tio delayed single-shot output mode the following describes precautions to be observed when using tio delayed single-shot output mode. ? if the counter stops due to underflow in the same clock period as the timer is enabled by external input, the former has priority (so that the counter stops). ? if the counter stops due to underflow in the same clock period as count is enabled by writing to the enable bit, the latter has priority (so that count is enabled). ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? when you read the counter immediately after reloading it pursuant to underflow, the value you get is temporarily h'ffff. but this counter value immediately changes to (reload value - 1) at the next clock edge.
10 10-137 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) figure 10.4.15 typical operation in tio deleted single-shot output mode (without correction function) aaaaaaaaaaaaaa aaaaaaaaaaaaaa h'ffff h'0000 underflow (first time) down-count starting from counter set value h'f000 h'a000 underflow (second time) h'f000 down-count starting from reload 0 register set value h'efff (not used) f/f output tio interrupt by underflow data inverted by underflow reload 1 register enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. data inverted by underflow
10 10-138 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) 10.4.14 operation in tio continuous output mode (without correction function) (1) outline of tio continuous output mode in continuous output mode, the timer counts down clock pulses starting from the set value of the counter and when the counter underflows, reloads it with reload 0 register value. thereafter, this operation is repeated each time the counter underflows, thus generating consecutive pulses whose waveform is inverted in width of (reload 0 register set value + 1). when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by external input), it starts counting down from the counter's set value synchronously with the count clock and when the minimum count is reached, generates an underflow. this underflow causes the counter to be reloaded with the content of reload 0 register and start counting over again. thereafter, this operation is repeated each time an underflow occurs. to stop the counter, disable count by writing to the enable bit in software. the f/f output waveform in continuous output mode is inverted (f/f output levels change from low to high, or vice versa) at startup and upon underflow, generating consecutive pulses until the timer stops counting. also, an interrupt can be generated each time the counter underflows. the valid count values are the (counter set value + 1) and (reload 0 register set value + 1). for details about count operation, also see section 10.3.11, "operation in top continuous output m10.4 tio (input/output-related 16-bit timer) (2) precautions to be observed when using tio continuous output mode the following describes precautions to be observed when using tio continuous output mode. ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? when you read the counter immediately after reloading it pursuant to underflow, the value you get is temporarily h'ffff. but this counter value immediately changes to (reload value - 1) at the next clock edge. ? because the internal circuit operation is synchronized to the count clock (prescaler output), a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled.
10 10-139 ver.0.10 multijunction timers 10.4 tio (input/output-related 16-bit timer) aaaaaaaaaaaaaa aaaaaaaaaaaaaa h'ffff h'0000 h'e000 h'a000 h'e000 h'dfff data inverted by enable h'dfff underflow (first time) down-count starting from counter set value underflow (second time) down-count starting from reload 0 register set value (not used) f/f output tio interrupt by underflow data inverted by underflow reload 1 register enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. down-count starting from reload 0 register set value figure 10.4.16 typical operation in tio continuous output mode (without correction function)
10 10-140 ver.0.10 10.5 tms (input-related 16-bit timer) 10.5.1 outline of tms tms (timer measure small) is an input-related 16-bit timer capable of measuring input pulses in two circuit blocks comprising a total eight channels. the table below shows specifications of tms. the diagram in the next page shows a block diagram of tms. table 10.5.1 specifications of tms (input-related 16-bit timer) 10.5.2 outline of tms operation in tms, when the timer is started by writing to the enable bit in software, the counter starts operating. the counter is a 16-bit up-counter, where when a measure signal is entered from an external device, the counter value is latched into each measure register. the counter stops counting at the same time count is disabled by writing to the enable bit in software. a tin interrupt can be generated by entering an external measure signal. also, a tms interrupt can be generated by a counter overflow. item specification number of channels 8 channels (2 circuit blocks consisting of 4 channels each, 8 channels in total) counter 16-bit up-counter x 2 measure register 16-bit measure register x 8 timer startup started by writing to enable bit in software interrupt generation can be generated by a counter overflow multijunction timers 10.5 tms (input-related 16-bit timer)
10 10-141 ver.0.10 figure 10.5.1 block diagram of tms (input-related 16-bit timer) multijunction timers 10.5 tms (input-related 16-bit timer) 3 2 1 0 3 2 1 0 clk tms 0 s ovf cap3 cap2 cap1 cap0 s s s s tclk3 tclk3s tin12s drq3 tin13s irq10 tin12 tin13 tin14s tin14 tin15s tin15 clk tms 1 ovf cap3 cap2 cap1 cap0 s s s s s tin16s drq5 tin17s tin16 tin17 tin18s tin18 tin19s tin19 drq6 irq10 irq10 irq10 irq10 irq10 irq10 irq10 0 1 2 3 irq7 irq7 s 3 2 1 0 3 2 1 0 0 1 2 3 measure register 3 measure register 2 measure register 1 measure register 0 counter (16 bits) clock bus input event bus output event bus : selector
10 10-142 ver.0.10 10.5.3 tms related register map the diagram below shows a tms related register map. figure 10.5.2 tms related register map h'0080 03c0 d0 d7 d8 d15 h'0080 03c2 h'0080 03c4 h'0080 03c6 tms0 measure 2 register (tms0mr2) tms0 measure 1 register (tms0mr1) h'0080 03ca tms1 control register (tms1cr) h'0080 03c8 tms0 control register (tms0cr) tms0 measure 3 register (tms0mr3) tms0 measure 0 register (tms0mr0) h'0080 03d0 h'0080 03d2 h'0080 03d4 h'0080 03d6 h'0080 03d8 +0 address +1 address address tms counter (tms0ct) note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. tms1 measure 2 register (tms1mr2) tms1 measure 1 register (tms1mr1) tms1 measure 3 register (tms1mr3) tms1 measure 0 register (tms1mr0) tms1 counter (tms1ct) ~ ~ ~ ~ multijunction timers 10.5 tms (input-related 16-bit timer)
10 10-143 ver.0.10 10.5.4 tms control registers the tms control registers are used to select tms0/1 input events and the counter clock source, as well as control counter startup. following two tms control registers are included: ? tms0 control register (tms0cr) ? tms1 control register (tms1cr) n tms0 control register (tms0cr) d bit name function r w 0 tms0ss0 0: external input tin15 (tms0 measure 0 source selection) 1: input event bus 0 1 tms0ss1 0: external input tin14 (tms0 measure 1 source selection) 1: input event bus 1 2 tms0ss2 0: external input tin13 (tms0 measure 2 source selection) 1: input event bus 2 3 tms0ss3 0: external input tin12 (tms0 measure 3 source selection) 1: input event bus 3 4,5 tms0cks 00: external input tclk3 (tms0 clock source selection) 01: clock bus 0 10: clock bus 1 11: clock bus 3 6 no functions assigned 0 C 7 tms0cen 0: count stops (tms0 count enable) 1: count starts tms0 tms0 tms0 tms0 ss0 ss1 ss2 ss3 multijunction timers 10.5 tms (input-related 16-bit timer) d0123456d7 tms0cks tms0cen
10 10-144 ver.0.10 n tms1 control register (tms1cr) d bit name function r w 8 tms1ss0 0: external input tin19 (tms1measure 0 source selection) 1: input event bus 0 9 tms1ss1 0: external input tin18 (tms1 measure 1 source selection) 1: input event bus 1 10 tms1ss2 0: external input tin17 (tms1 measure 2 source selection) 1: input event bus 2 11 tms1ss3 0: external input tin16 (tms1 measure 3 source selection) 1: input event bus 3 12 no functions assigned 0 C 13 tms1cks 0: clock bus 0 (tms1 clock source selection) 1: clock bus 3 14 no functions assigned 0 C 15 tms1cen 0: count stops (tms1 count enable) 1: count starts d8 9 1011121314d15 tms1cks tms1cen tms1 tms1 tms1 tms1 ss0 ss1 ss2 ss3 multijunction timers 10.5 tms (input-related 16-bit timer)
10 10-145 ver.0.10 10.5.5 tms counter (tms0ct, tms1ct) n tms0 counter (tms0ct) n tms1 counter (tms1ct) d bit name function r w 0-15 tms0ct, tms1ct 16-bit counter value note: this register must always be accessed in halfwords. the tms counters are a 16-bit up-counter, which starts counting when the timer is enabled (by writing to the enable bit in software). the counter can be read on-the-fly. d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tms0ct, tms1ct multijunction timers 10.5 tms (input-related 16-bit timer)
10 10-146 ver.0.10 10.5.6 tms measure registers (tms0mr3-0, tms1mr3-0) n tms0 measure 3 register (tms0mr3) n tms0 measure 2 register (tms0mr2) n tms0 measure 1 register (tms0mr1) n tms0 measure 0 register (tms0mr0) n tms1 measure 3 register (tms1mr3) n tms1 measure 2 register (tms1mr2) n tms1 measure 1 register (tms1mr1) n tms1 measure 0 register (tms1mr0) note 1: this register is a read-only register. note 2: this register can be accessed in either byte or halfword. the tms measure registers are used to latch counter contents upon event input. the tms measure registers are a read-only register. d bit name function r w 0-15 tms0mr3-tms0mr0 16-bit reload register value C tms1mr3-tms1mr0 d01234567891011121314d15 tms0mr3-0, tms1mr3-0 multijunction timers 10.5 tms (input-related 16-bit timer)
10 10-147 ver.0.10 10.5.7 operation of tms measure input (1) outline of tms measure input in tms measure input, the counter starts counting up clock pulses when the timer is actuated by writing to the enable bit in software. when event input is entered to tms while the timer is operating, the counter value is latched into measure registers 0-3. the timer stops at the same time count is disabled by writing to the enable bit. a tin interrupt can be generated by entering a measure signal from an external device. also, when the counter overflows, a tms interrupt can be generated. figure 10.5.3 typical operation in tms measure input count clock counter h'ffff h'0000 enabled (by writing to enable bit) measure event 1 occurs initial value (indeterminate) enable bit note: this diagram does not show detail timing information. measure 0 register h'8000 overflow occurs tin15 interrupt h'c000 measure event 0 occurs tms interrupt by overflow h'c000 h'6000 h'd000 h'6000 h'd000 h'8000 indeterminate value measure event 1 occurs measure event 0 occurs initial value (indeterminate) measure 1 register tin14 interrupt multijunction timers 10.5 tms (input-related 16-bit timer)
10 10-148 ver.0.10 (2) precautions to be observed when using tms measure input the following describes precautions to be observed when using tms measure input. ? if measure event input and write to the counter occur simultaneously in the same clock period, the write value is set in the counter while at the same time latched to the measure register. multijunction timers 10.5 tms (input-related 16-bit timer)
10 10-149 ver.0.10 10.6 tml (input-related 32-bit timer) 10.6.1 outline of tml tml (timer measure large) is an input-related 32-bit timer capable of measuring input pulses in two circuit blocks comprising a total of eight channels. the table below shows specifications of tml. the diagram in the next page shows a block diagram of tml. table 10.6.1 specifications of tml (input-related 32-bit timer) item specification number of channels 8 channels (2 circuit blocks consisting of 4 channels each, 8 channels in total) input clock divided-by-2 frequency of the internal peripheral operating clock (e.g., 10.0 mhz when using 20 mhz internal peripheral operating clock) or clock bus 1 input counter 32-bit up-counter 2 measure register 32-bit measure register 8 timer startup starts counting after leaving reset multijunction timers 10.6 tml (input-related 32-bit timer)
10 10-150 ver.0.10 figure 10.6.1 block diagram of tml (input-related 32-bit timer) 10.6.2 outline of tml operation in tml, the counter starts counting upon deassertion of reset. the counter is a 32-bit up-counter, where when a measure event signal is entered from an external device, the counter value at that point in time is stored in each 32-bit measure register. when reset input is deasserted, the counter starts operating with a divided-by-2 frequency of the internal peripheral clock, and cannot be stopped once it has started. the counter is idle only when the device remains reset. a tin interrupt can be generated by entering an external measure signal. however, no tml counter overflow interrupts are available. multijunction timers 10.6 tml (input-related 32-bit timer) 3 2 1 0 3 2 1 0 s s s s tin20s tin21s tin20 tin21 tin22s tin22 tin23s tin23 irq11 irq11 irq11 irq11 1/2 internal peripheral clock 0 1 2 3 s 3 2 1 0 3 2 1 0 0 1 2 3 clk tml0 cap3 cap2 cap1 cap0 s s s s s tin30s tin31s tin30 tin31 tin32s tin32 tin33s tin33 irq18 irq18 irq18 irq18 clk tml1 cap3 cap2 cap1 cap0 s measure register 3 measure register 2 measure register 1 measure register 0 counter (32 bits) clock bus input event bus output event bus : selector measure register 3 measure register 2 measure register 1 measure register 0 counter (32 bits)
10 10-151 ver.0.10 10.6.3 tml related register map the diagram below shows a tml related register map. figure 10.6.2 tml related register map multijunction timers 10.6 tml (input-related 32-bit timer) h'0080 03e0 d0 d7 d8 d15 h'0080 03e2 tml0 counter, high (tml0cth) h'0080 03ea tml0 counter, low (tml0ctl) h'0080 03f0 h'0080 03f2 h'0080 03f4 h'0080 03f6 tml0 measure 3 register, low (tml0mr3l) h'0080 03f8 h'0080 03fa h'0080 03fc h'0080 03fe tml0 measure 3 register, high (tml0mr3h) h'0080 0fe0 h'0080 0fe2 h'0080 0fea h'0080 0ff0 h'0080 0ff2 h'0080 0ff4 h'0080 0ff6 h'0080 0ff8 h'0080 0ffa h'0080 0ffc h'0080 0ffe tml0 control register (tml0cr) +0 address +1 address address note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. tml0 measure 2 register, low (tml0mr2l) tml0 measure 2 register, high (tml0mr2h) tml0 measure 1 register, low (tml0mr1l) tml0 measure 1 register, high (tml0mr1h) tml0 measure 0 register, low (tml0mr0l) tml0 measure 0 register, high (tml0mr0h) tml1 counter, high (tml1cth) tml1 counter, low (tml1ctl) tml1 measure 3 register, low (tml1mr3l) tml1 measure 3 register, high (tml1mr3h) tml1 control register (tml1cr) tml1 measure 2 register, low (tml1mr2l) tml1 measure 2 register, high (tml1mr2h) tml1 measure 1 register, low (tml1mr1l) tml1 measure 1 register, high (tml1mr1h) tml1 measure 0 register, low (tml1mr0l) tml1 measure 0 register, high (tml1mr0h)
10 10-152 ver.0.10 10.6.4 tml control registers n tml0 control register (tml0cr) the tml0 control register is used to select tml0 input event and the counter clock source. note: the counter can be written to normally only when the selected clock source is a 1/2 internal peripheral clock. when using any other clock source, you cannot write to the counter normally. under this condition, do not write to the counter. d bit name function r w 8 tml0ss0 0: external input tin23 (tml0 measure 0 source selection) 1: input event bus 0 9 tml0ss1 0: external input tin22 (tml0 measure 1 source selection) 1: input event bus 1 10 tml0ss2 0: external input tin21 (tml0 measure 2 source selection) 1: input event bus 2 11 tml0ss3 0: external input tin20 (tml0 measure 3 source selection) 1: input event bus 3 12-14 no functions assigned 0 C 15 tml0cks 0: 1/2 internal peripheral clock (tml0 clock source selection) 1: clock bus 1 d8 9 1011121314d15 tml0ss0 tml0ss1 tml0ss2 tml0ss3 tml0cks multijunction timers 10.6 tml (input-related 32-bit timer)
10 10-153 ver.0.10 n tml1 control register (tml1cr) d8 9 1011121314d15 tml1ss0 tml1ss1 tml1ss2 tml1ss3 tml1cks d bit name function r w 8 tml1ss0 0: external input tin33 (tml1 measure 0 source selection) 1: input event bus 0 9 tml1ss1 0: external input tin32 (tml1 measure 1 source selection) 1: input event bus 1 10 tml1ss2 0: external input tin31 (tml1 measure 2 source selection) 1: input event bus 2 11 tml1ss3 0: external input tin30 (tml1 measure 3 source selection) 1: input event bus 3 12-14 no functions assigned 0 C 15 tml1cks 0: 1/2 internal peripheral clock (tml1 clock source selection) 1: clock bus 1 the tml1 control register is used to select tml1 input event and the counter clock source. note: the counter can be written to normally only when the selected clock source is a 1/2 internal peripheral clock. when using any other clock source, you cannot write to the counter normally. under this condition, do not write to the counter. multijunction timers 10.6 tml (input-related 32-bit timer)
10 10-154 ver.0.10 10.6.5 tml counters n tml0 counter, high (tml0cth) n tml0 counter, low (tml0ctl) note: this register must always be accessed in words (32 bits) beginning with the address of tml0cth. the tml0 counter is a 32-bit up-counter, which starts counting upon deassertion of reset. the tml0cth register accommodates the 16 high-order bits, and the tml0ctl register accommodates the 16 low-order bits of the 32-bit counter. the counter can be read on-the-fly. d01234567891011121314d15 tml0cth (16 high-order bits) d01234567891011121314d15 tml0ctl (16 low-order bits) d bit name function r w 0-15 tml0cth 32-bit counter value (16 high-order bits) tml0ctl 32-bit counter value (16 low -order bits) multijunction timers 10.6 tml (input-related 32-bit timer)
10 10-155 ver.0.10 n tml1 counter, high (tml1cth) n tml1 counter, low (tml1ctl) note: this register must always be accessed in words (32 bits) beginning with the address of tml1cth. the tml1 counter is a 32-bit up-counter, which starts counting upon deassertion of reset. the tml1cth register accommodates the 16 high-order bits, and the tml1ctl register accommodates the 16 low-order bits of the 32-bit counter. the counter can be read on-the-fly. d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tml1cth (16 high-order bits) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tml1ctl (16 low-order bits) d bit name function r w 0-15 tml1cth 32-bit counter value (16 high-order bits) tml1ctl 32-bit counter value (16 low -order bits) multijunction timers 10.6 tml (input-related 32-bit timer)
10 10-156 ver.0.10 10.6.6 tml measure registers n tml0 measure 3 register (tml0mr3h) n tml0 measure 3 register (tml0mr3l) n tml0 measure 2 register (tml0mr2h) n tml0 measure 2 register (tml0mr2l) n tml0 measure 1 register (tml0mr1h) n tml0 measure 1 register (tml0mr1l) n tml0 measure 0 register (tml0mr0h) n tml0 measure 0 register (tml0mr0l) note 1 : these registers are a read-only register. note 2: these registers must always be accessed in words (32 bits) beginning with a word boundary. the tml0 measure registers are used to latch counter contents upon event input. the tml0 measure registers are configured with 32 bits, the tml0mr3h-0h accommodating the 16 high- order bits, and the tml0mr3l-0l accommodating the 16 low-order bits. the tml0 measure registers are a read-only register. these registers must always be accessed in words (32 bits) beginning with a word boundary. d01234567891011121314d15 tml0mr3h-tml0mr0h (16 high-order bits) d01234567891011121314d15 tml0mr3l-tml0mr0l (16 low-order bits) d bit name function r w 0-15 tml0mr3h-0h 32-bit counter value (16 high-order bits) C tml0mr3l-0l 32-bit counter value (16 low -order bits) multijunction timers 10.6 tml (input-related 32-bit timer)
10 10-157 ver.0.10 n tml1 measure 3 register (tml1mr3h) n tml1 measure 3 register (tml1mr3l) n tml1 measure 2 register (tml1mr2h) n tml1 measure 2 register (tml1mr2l) n tml1 measure 1 register (tml1mr1h) n tml1 measure 1 register (tml1mr1l) n tml1 measure 0 register (tml1mr0h) n tml1 measure 0 register (tml1mr0l) note 1 : these registers are a read-only register. note 2: these registers must always be accessed in words (32 bits) beginning with a word boundary. the tml1 measure registers are used to latch counter contents upon event input. the tml1 measure registers are configured with 32 bits, the tml1mr3h-0h accommodating the 16 high- order bits, and the tml1mr3l-0l accommodating the 16 low-order bits. the tml1 measure registers are a read-only register. these registers must always be accessed in words (32 bits) beginning with a word boundary. d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tml1mr3h-tml1mr0h (16 high-order bits) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tml1mr3l-tml1mr0l (16 low-order bits) d bit name function r w 0-15 tml1mr3h-0h 32-bit counter value (16 high-order bits) C tml1mr3l-0l 32-bit counter value (16 low -order bits) multijunction timers 10.6 tml (input-related 32-bit timer)
10 10-158 ver.0.10 counter (32 bits) h'ffff ffff h'0000 0000 reset h'8000 0000 h'c000 0000 h'8000 0000 h'c000 0000 h'6000 0000 h'd000 0000 h'6000 0000 h'd000 0000 count clock enabled (by deassertion of reset) measure event 1 occurs initial value (indeterminate) note: this diagram does not show detail timing information. measure 0 register overflow occurs tin23 interrupt measure event 0 occurs indeterminate value measure event 1 occurs measure event 0 occurs measure 1 register tin22 interrupt initial value (indeterminate) 10.6.7 operation of tml measure input (1) outline of tml measure input in tml measure input, the counter starts counting up clock pulses upon deassertion of reset. when event input is entered to measure registers 0-3, the counter value is latched into the measure registers. a tin interrupt can be generated by entering an external measure signal. (no tml counter overflow interrupts are available.) figure 10.6.3 typical operation in tml measure input multijunction timers 10.6 tml (input-related 32-bit timer)
10 10-159 ver.0.10 (2) precautions to be observed when using tml measure input the following describes precautions to be observed when using tml measure input. ? if measure event input and write to the counter occur simultaneously in the same clock period, the write value is set in the counter, whereas the up-count value (before being rewritten) is latched to the measure register. ? if the timer operates with any clock other than the 1/2 internal peripheral clock while clock bus 1 is selected for the count clock, the counter cannot be written to normally. therefore, when operating with any clock other than the 1/2 internal peripheral clock, do not write to the counter. ? if the timer operates with any clock other than the 1/2 internal peripheral clock while clock bus 1 is selected for the count clock, the captured value is one that leads the actual counter value by one clock period. however, during the 1/2 internal peripheral clock interval from the count clock, this problem does not occur and the counter value is captured at exact timing. the diagram below shows the relationship between counter operation and the valid data that can be captured. multijunction timers 10.6 tml (input-related 32-bit timer) counter b acdef a bcde ?when 1/2 internal peripheral clock is selected 1/2 internal peripheral clock capture counter b ac ?when clock bus 1 is selected 1/2 internal peripheral clock count clock capture bcd f figure 10.6.4 mistimed counter value and captured value
10 10-160 ver.0.10 10.7 tid (input-related 16-bit timer) 10.7.1 outline of tid tid (timer input derivation) is an input-related 16-bit timer, whose operation mode can be selected from the following by mode switching in software: ? fixed period count mode ? event count mode ? multiply-by-4 event count mode the table below shows specifications of tid. the diagram in the next page shows a block diagram of tid. table 10.7.1 specifications of tid (input-related 16-bit timer) item specification number of channels 3 channels counter 16-bit up/down-counter reload register 16-bit reload register timer startup started by writing to enable bit in software mode selection ? fixed period count mode ? event count mode ? multiply-by-4 event count mode interrupt generation can be generated by a counter underflow and overflow multijunction timers 10.7 tid (input-related 16-bit timer)
10 10-161 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) figure 10.7.1 block diagram of tid (input-related 16-bit timer) up/down-counter tid0 irq14 psc3 tin24 tin25 s 1/2 internal peripheral clock built-in edge control circuit clk1 clk2 tod0_0 - 7 reload register clk tid1 ad1trg (to a-d1 converter) psc4 tin26 tin27 s clk1 clk2 tod1_0 - 7 clk tod1_0 - tod1_7 enable signal irq15 psc5 tom0_0 - tom0_7 enable signal irq17 psc3 - 5 : prescaler 1/2 internal peripheral clock up/down-counter built-in edge control circuit reload register tid2 s clk1 clk2 tom0_0 - 7 clk up/down-counter built-in edge control circuit reload register tin28 tin29 1/2 internal peripheral clock
10 10-162 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) figure 10.7.2 tid related register map 10.7.2 tid related register map the diagram below shows a tid related register map. address d0 d7 +0 address +1 address d8 d15 note: the registers enclosed in thick frames must always be accessed in halfwords. h'0080 078c h'0080 0b8e h'0080 0bd0 h'0080 0b8c h'0080 0cd0 h'0080 0c8c h'0080 0c8e blank addresses are reserved. tid0 counter (tid0ct) tid0 reload register (tid0rl) prescaler register 3 (prs3) tid0 control & prescaler 3 enable register (tid0prs3en) h'0080 078e h'0080 07d0 tid1 counter (tid1ct) tid1 reload register (tid1rl) prescaler register 4 (prs4) tid1 control & prescaler 4 enable register (tid1prs4en) tid2 counter (tid2ct) tid2 reload register (tid2rl) prescaler register 5 (prs5) tid2 control & prescaler 5 enable register (tid2prs5en)
10 10-163 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) 10.7.3 tid control &prescaler enable registers n tid0 control &prescaler 3 enable register (tid0prs3en) d8 9 1011121314d15 tid0m tid0cen prs3en d bit name function r w 8 no functions assigned 0 9, 10 tid0m 0x : fixed period count mode (tid0 operation mode selection) 10 : multiply-by-4 event count mode 11 : event count mode 11 tid0cen 0 : count stops (tid0 count enable) 1 : count starts 12 - 14 no functions assigned 0 15 prs3en 0 : count stops (prescaler 3 enable) 1 : count starts note: always make sure the counter has stopped and is idle before setting or changing operation modes. the tid0 control & prescaler 3 enable register selects tid0 operation mode (fixed period count mode, event count mode, or multiply-by-4 event count mode) and controls prescaler 3 startup.
10 10-164 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) n tid1 control &prescaler 4 enable register (tid1prs4en) d8 9 1011121314d15 tid1m tid1cen tid1eno prs4en d bit name function r w 8 no functions assigned 0 9, 10 tid1m 0x : fixed period count mode (tid1 operation mode selection) 10 : multiply-by-4 event count mode 11 : event count mode 11 tid1cen 0 : count stops (tid1 count enable) 1 : count starts 12 no functions assigned 0 13 tid1eno 0 : disables enable output to tod1_0-7 (tid1 enable output enable) 1 : enables enable output to tod1_0-7 14 no functions assigned 0 15 prs4en 0 : count stops (prescaler 4 enable) 1 : count starts note: always make sure the counter has stopped and is idle before setting or changing operation modes. the tid1 control & prescaler 4 enable register selects tid1 operation mode (fixed period count mode, event count mode, or multiply-by-4 event count mode) and controls prescaler 4 startup.
10 10-165 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) n tid2 control &prescaler 5 enable register (tid2prs5en) d8 9 1011121314d15 tid2m tid2cen tid2eno prs5en d bit name function r w 8 no functions assigned 0 9, 10 tid2m 0x : fixed period count mode (tid2 operation mode selection) 10 : multiply-by-4 event count mode 11 : event count mode 11 tid2cen 0 : count stops (tid2 count enable) 1 : count starts 12 no functions assigned 0 13 tid2eno 0 : disables enable output to tom0_0-7 (tid2 enable output enable) 1 : enables enable output to tom0_0-7 14 no functions assigned 0 15 prs5en 0 : count stops (prescaler 5 enable) 1 : count starts note: always make sure the counter has stopped and is idle before setting or changing operation modes. the tid2 control & prescaler 5 enable register selects tid2 operation mode (fixed period count mode, event count mode, or multiply-by-4 event count mode) and controls prescaler 5 startup.
10 10-166 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) 10.7.4 tid counters (tid0ct, tid1ct, tid2ct) n tid0 counter (tid0ct) n tid1 counter (tid1ct) n tid2 counter (tid2ct) d01234567891011121314d15 tid0ct, tid1ct, tid2ct d bit name function r w 0 - 15 tid0ct, tid1ct, tid2ct 16-bit counter value note: this register must always be accessed in halfwords. the tid counters are a 16-bit up/down-counter. after the timer is enabled (by writing to the enable bit in software), the counter starts counting synchronously with the count clock.
10 10-167 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) 10.7.5 tid reload registers (tid0rl, tid1rl, tid2rl) n tid0 reload register (tid0rl) n tid1 reload register (tid1rl) n tid2 reload register (tid2rl) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tid0rl, tid1rl, tid2rl d bit name function r w 0 - 15 tid0rl, tid1rl, tid2rl 16-bit reload register value note: this register must always be accessed in halfwords. the tid reload registers are used to reload the tid counter registers (tid0ct, tid1ct, or tid2ct) with data. it is in the following cases that the content of the reload register is loaded into the counter: ? when the counter underflowed in fixed period count mode ? when the counter is enabled in fixed period count mode writing data to the reload register does not mean that the data is loaded into the counter simultaneously.
10 10-168 ver.0.10 10.7.6 outline of each mode of tid each mode of tid is outlined below. tid modes can be selected from the following, only one at a time: (1) fixed period count mode in fixed period count mode, the timer uses a reload register to generate an interrupt at intervals of (reload register set value + 1). when after setting the reload register (initial value being indeterminate), the timer is enabled (by writing to the enable bit in software), it loads the content of the reload register into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clockpulses and when it underflows after reaching the minimum count, the counter is reloaded with the content of the reload register again and continues counting. to stop the counter, disable count by writing to the enable bit. also, an interrupt can be generated each time the counter underflows. the valid count value is the (reload register set value + 1). figure 10.7.3 typical operation in tid fixed period count mode multijunction timers 10.7 tid (input-related 16-bit timer) aaaaaaaaaaaaaaa h'ffff h'0000 h'e000 h'e000 h'dfff h'dfff enable- synchronized write h'e000 underflow (first time) tid0 interrupt by underflow underflow (second time) down-count starting from reload register set value enabled ( by writing to enable bit ) reload register count clock counter enable bit note: this diagram does not show detail timing information. down-count starting from reload register set value down-count starting from reload register set value
10 10-169 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) (2) event count mode in event count mode, the timer uses an external input signal (tin24, tin26, or tin28) as the clock source with which to operate the counter. note: tin25, tin27, and tin29 cannot be used as the clock source. by detecting rising and falling edges of the external input signal (tin24, tin26, or tin28), the timer generates clock pulses synchronized to the internal clock. when after setting the counter, the timer is enabled (by writing to the enable bit in software), the counter starts counting up from the set count value synchronously with the generated clock. an interrupt can be generated by a counter overflow. to stop the counter, disable count by writing to the enable bit in software or fix the external input signal high or low. figure 10.7.4 typical operation in tid event count mode (basic operation) figure 10.7.5 typical operation in tid event count mode (when overflow occurs) tin24 counter value 7fff 8000 8001 8002 8003 8004 tin24 fffe ffff 0000 0001 0002 0003 tid interrupt by overflow fffd counter value
10 10-170 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) (3) multiply-by-4 event count mode in multiply-by-4 event count mode, the timer uses two external input signals in pairs (tin24 and tin25, tin26 and tin27, or tin28 and tin29) as the clock sources with which to operate the counter. the count direction is switched between up-count and down-count depending on the status of the two input signals. the two externally sourced signals both are sampled to detect rising and falling edges as the timer generates clock pulses synchronized to the internal clock. when after setting the counter, the timer is enabled (by writing to the enable bit in software), the counter starts counting up synchronously with the generated clock. for details on whether the counter counts up or counts down, see table 10.7.2 below. an interrupt can be generated by a counter overflow and/or underflow. to stop the counter, disable count by writing to the enable bit in software or fix the external input signals high or low. table 10.7.2 count direction during multiply-by-4 event count mode tin24 (tin26, tin28) tin25 (tin27, tin29) input h h l l h l lh up-count down-count count direction
10 10-171 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) figure 10.7.6 up/down count operation (switchover timing) figure 10.7.7 up/down count operation (count enabled and disabled) tin24 tin25 up-count down-count 8000 8001 8002 8001 8000 8003 7ffe 8003 counter value counter 8002 7fff 7ffe 7fff 7ffe switched over 8000 8001 8000 7fff 7ffe timer enable count disabled count enabled 7fff enable tin24 tin25 8001 7ffe counter value counter switched over up-count down-count count disabled count disabled count enabled
10 10-172 ver.0.10 multijunction timers 10.7 tid (input-related 16-bit timer) figure 10.7.8 up/down count operation (interrupt timing) tid interrupt ffff 0000 0001 0000 ffff 0002 0001 fffe fffd fffe fffd tin24 tin25 up-count down-count ffff 0000 counter value counter switched over
10 10-173 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8 tod (output-related 16-bit timer) 10.8.1 outline of tod tod (timer output derivation) is an output-related 16-bit timer, whose operation mode can be selected from the following by mode switching in software. this timer is a variation of tio, with tio input modes removed. ? pwm output mode ? single-shot output mode ? delayed single-shot output mode ? continuous output mode the table below shows specifications of tod. the diagram in the next page shows a block diagram of tod. table 10.8.1 specifications of tod (output-related 16-bit timer) item specification number of channels 16 channels (two circuit blocks consisting of 8 channels each, 16 channels in total) counter 16-bit down-counter x 2 reload register 16-bit reload register x 2 timer startup tod0 : started by writing to enable bit in software tod1 : started by writing to enable bit in software or by tid1 timer underflow/overflow signal mode selection ? pwm output mode ? single-shot output mode ? delayed single-shot output mode ? continuous output mode interrupt generation can be generated by a counter underflow
10 10-174 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.1 block diagram of tod (output-related 16-bit timer) clk udf tod0_0 clk udf tod0_1 clk udf tod0_2 clk udf tod0_3 clk udf tod0_4 clk udf tod0_5 clk udf tod0_6 clk udf tod0_7 f/f21 f/f22 f/f23 f/f24 f/f25 f/f26 f/f27 f/f28 f/f psc3, 4 irq13 to 21 to 22 to 23 to 24 to 25 to 26 to 27 to 28 psc3 clk udf tod1_0 clk udf tod1_1 clk udf tod1_2 clk udf tod1_3 clk udf tod1_4 clk udf tod1_5 clk udf tod1_6 clk udf tod1_7 f/f29 f/f30 f/f31 f/f32 f/f33 f/f34 f/f35 f/f36 irq16 to 29 to 30 to 31 to 32 to 33 to 34 to 35 to 36 psc4 en en en en en en en en clk udf tid1 ovf irq15 ad1trg (to a-d1 converter) clk1 clk2 tin26 tin27 : prescaler : output flip-flop 1/2 internal peripheral clock 1/2 internal peripheral clock clk udf tid0 ovf irq14 clk1 clk2 tin24 tin25
10 10-175 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.2 outline of each mode of tod each mode of tod is outlined below. for each tod channel, only one of the following modes can be selected. (1) pwm output mode (without correction function) in pwm output mode, the timer uses two reload registers to generate a waveform with a given duty cycle. when after setting the initial values in reload 0 and reload 1 registers, the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it loads the reload 0 register value into the counter synchronously with the count clock, letting the counter start counting down. the first time the counter underflows, the reload 1 register value is loaded into the counter letting it continue counting. thereafter, the counter is reloaded with the reload 0 and reload 1 register values alternately each time an underflow occurs. the f/f output waveform in pwm output mode is inverted at count startup and upon each underflow. the timer stops at the same time count is disabled by writing to the enable bit (and not in synchronism with pwm output period). an interrupt can be generated when the counter underflows every other time (second time, fourth time, and so on) after being enabled. (2) single-shot output mode (without correction function) in single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once and stops without performing any operation. when after setting the reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it loads the content of reload 0 register into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clock pulses and stops when it underflows after reaching the minimum count. the f/f output waveform in single-shot output mode is inverted at startup and upon underflow, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once. also, an interrupt can be generated when the counter underflows.
10 10-176 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) (3) delayed single-shot output mode (without correction function) in delayed single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once, with the output delayed by an amount of time equal to (counter set value + 1) and then stops without performing any operation. when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it starts counting down from the counter's set value synchronously with the count clock. the first time the counter underflows, the reload 0 register value is loaded into the counter causing it to continue counting down, and the counter stops when it underflows next time. the f/f output waveform in delayed single-shot output mode is inverted when the counter underflows first time and next, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once, with the output delayed by an amount of time equal to (first set value + 1) only once, with the output delayed by an amount of time equal to (first set value of counter + 1). also, an interrupt can be generated when the counter underflows first time and next. (4) continuous output mode (without correction function) in continuous output mode, the timer counts down clock pulses starting from the set value of the counter and when the counter underflows, reloads it with the reload 0 register value. thereafter, this operation is repeated each time the counter underflows, thus generating consecutive pulses in width of (reload 0 register set value + 1). when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it starts counting down from the counter's set value synchronously with the count clock and when the minimum count is reached, generates an underflow. this underflow causes the counter to be reloaded with the content of reload 0 register and start counting again. thereafter, this operation is repeated each time an underflow occurs. to stop the counter, disable count by writing to the enable bit in software. the f/f output waveform in continuous output mode is inverted at startup and upon underflow, generating consecutive pulses until the timer stops counting. also, an interrupt can be generated each time the counter underflows.
10 10-177 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.3 tod related register map the diagram below shows a tod related register map. figure 10.8.2 tod related register map (1/3) address d0 d7 +0 address +1 address d8 d15 note : the registers enclosed in thick frames must always be accessed in halfwords. h'0080 0790 h'0080 0798 h'0080 07a0 h'0080 0794 h'0080 07aa h'0080 07a4 h'0080 07a6 blank addresses are reserved. tod0_0 counter (tod00ct) h'0080 0792 tid0_1 counter (tod01ct) tod0_0 reload 1 register (tod00rl1) h'0080 0796 tod0_0 reload 0 register (tod00rl0) h'0080 079c tid0_2 counter (tod02ct) tod0_1 reload 1 register (tod01rl1) h'0080 079e tod0_1 reload 0 register (tod01rl0) h'0080 079a h'0080 07a8 tid0_3 counter (tod03ct) tod0_2 reload 1 register (tod02rl1) tod0_2 reload 0 register (tod02rl0) h'0080 07a2 h'0080 07ac h'0080 07ae h'0080 07b0 h'0080 07b2 h'0080 07b4 h'0080 07b6 h'0080 07b8 h'0080 07ba h'0080 07bc h'0080 07be tod0_3 reload 1 register (tod03rl1) tod0_3 reload 0 register (tod03rl0) tid0_4 counter (tod04ct) tod0_4 reload 1 register (tod04rl1) tod0_4 reload 0 register (tod04rl0) tid0_5 counter (tod05ct) tod0_5 reload 1 register (tod05rl1) tod0_5 reload 0 register (tod05rl0)
10 10-178 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.3 tod related register map (2/3) address d0 d7 +0 address +1 address d8 d15 note 1: prescaler register 3 is shared with tod0_0-7 and tid0, and tid0 control & prescaler 3 enable register is used in tid0 control. note 2: the registers enclosed in thick frames must always be accessed in halfwords. h'0080 07c0 h'0080 07c8 h'0080 07d0 h'0080 07c4 h'0080 07da h'0080 07d4 h'0080 07d6 blank addresses are reserved. tod0_6 counter (tod06ct) h'0080 07c2 tid0_7 counter (tod07ct) prescaler register 3 (prs3) tid0 control & prescaler 3 enable register (tid0prs3en) tod0_6 reload 1 register (tod06rl1) h'0080 07c6 tod0_6 reload 0 register (tod06rl0) h'0080 07cc tod0_7 reload 1 register (tod07rl1) h'0080 07ce tod0_7 reload 0 register (tod07rl0) h'0080 07ca h'0080 07d8 h'0080 07d2 h'0080 07dc h'0080 07de h'0080 0b90 h'0080 0b92 h'0080 0b94 h'0080 0b96 h'0080 0b98 h'0080 0b9a h'0080 0b9c h'0080 0b9e h'0080 0ba0 h'0080 0ba2 h'0080 0ba4 h'0080 0ba6 (note 1) tod0 interrupt status register (tod0ist) tod0 interrupt mask register (tod0ima) f/f protect register 2 (ffp2) f/f data register 2 (ffd2) tod0 enable protect register (tod0pro) tod0 control register (tod0cr) tod0 count enable register (tod0cen) h'0080 0ba8 h'0080 0baa h'0080 0bac h'0080 0bae tod1_0 counter (tod10ct) tid1_1 counter (tod11ct) tod1_0 reload 1 register (tod10rl1) tod1_0 reload 0 register (tod10rl0) tod1_1 reload 1 register (tod11rl1) tod1_1 reload 0 register (tod11rl0) tod1_2 counter (tod12ct) tid1_3 counter (tod13ct) tod1_2 reload 1 register (tod12rl1) tod1_2 reload 0 register (tod12rl0) tod1_3 reload 1 register (tod13rl1) tod1_3 reload 0 register (tod13rl0)
10 10-179 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.4 tod related register map (3/3) address d0 d7 +0 address +1 address d8 d15 note 1: prescaler register 3 is shared with tod0_0-7 and tid0, and tid0 control & prescaler 3 enable register is used in tid0 control. note 2: the registers enclosed in thick frames must always be accessed in halfwords. h'0080 0bb0 h'0080 0bb8 h'0080 0bc0 h'0080 0bb4 h'0080 0bca h'0080 0bc4 h'0080 0bc6 blank addresses are reserved. tod1_4 counter (tod14ct) h'0080 0bb2 tid1_5 counter (tod15ct) prescaler register 4 (prs4) tid1 control & prescaler 4 enable register (tod1prs4en) tod1_4 reload 1 register (tod14rl1) h'0080 0bb6 tod1_4 reload 0 register (tod14rl0) h'0080 0bbc tid1_6 counter (tod16ct) tod1_5 reload 1 register (tod15rl1) h'0080 0bbe tod1_5 reload 0 register (tod15rl0) h'0080 0bba h'0080 0bc8 tid1_7 counter (tod17ct) tod1_6 reload 1 register (tod16rl1) tod1_6 reload 0 register (tod16rl0) h'0080 0bc2 h'0080 0bcc h'0080 0bce h'0080 0bd0 h'0080 0bd2 h'0080 0bd4 h'0080 0bd6 h'0080 0bd8 h'0080 0bda h'0080 0bdc h'0080 0bde tod1_7 reload 1 register (tod17rl1) tod1_7 reload 0 register (tod17rl0) (note 1) tod1 interrupt status register (tod1ist) tod1 interrupt mask register (tod1ima) f/f protect register 3 (ffp3) f/f data register 3 (ffd3) tod1 enable protect register (tod1pro) tod1 control register (tod1cr) tod1 count enable register (tod1cen)
10 10-180 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.4 tod control registers (tod0cr) n tod0 control registers (tod0cr) d01234567891011121314d15 tod00m tod01m tod02m tod03m tod04m tod05m tod06m tod07m d bit name function r w 0, 1 tod00m 00 : single-shot output mode (tod0_0 operation mode selection) 01 :delayed single-shot output mode 2, 3 tod01m 10 : continuous output mode (tod0_1 operation mode selection) 11 : pwm output mode 4, 5 tod02m (tod0_2 operation mode selection) 6, 7 tod03m (tod0_3 operation mode selection) 8, 9 tod04m (tod0_4 operation mode selection) 10, 11 tod05m (tod0_5 operation mode selection) 12, 13 tod06m (tod0_6 operation mode selection) 14, 15 tod07m (tod0_7 operation mode selection) the tod0 control register is used to select tod0_0-7 operation modes (pwm output, single-shot output, delayed single-shot output, or continuous output mode).
10 10-181 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) n tod1 control registers (tod1cr) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tod10m tod11m tod12m tod13m tod14m tod15m tod16m tod17m d bit name function r w 0, 1 tod10m 00 : single-shot output mode (tod1_0 operation mode selection) 01 :delayed single-shot output mode 2, 3 tod11m 10 : continuous output mode (tod1_1 operation mode selection) 11 : pwm output mode 4, 5 tod12m (tod1_2 operation mode selection) 6, 7 tod13m (tod1_3 operation mode selection) 8, 9 tod14m (tod1_4 operation mode selection) 10, 11 tod15m (tod1_5 operation mode selection) 12, 13 tod16m (tod1_6 operation mode selection) 14, 15 tod17m (tod1_7 operation mode selection) the tod1 control register is used to select tod1_0-7 operation modes (pwm output, single-shot output, delayed single-shot output, or continuous output mode).
10 10-182 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.5 tod counters n tod0_0 counter (tod00ct) n tod0_1 counter (tod01ct) n tod0_2 counter (tod02ct) n tod0_3 counter (tod03ct) n tod0_4 counter (tod04ct) n tod0_5 counter (tod05ct) n tod0_6 counter (tod06ct) n tod0_7 counter (tod07ct) d01234567891011121314d15 tod00ct - tod07ct d bit name function r w 0 - 15 tod00ct - tod07ct 16-bit counter value w = : write to this register is accepted in all but pwm output mode. note: this register must always be accessed in halfwords. the tod0 counter is a 16-bit down-counter. after the timer is enabled (by writing to the enable bit in software), it starts counting synchronously with the count clock. during pwm output mode, this counter is disabled against write.
10 10-183 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) n tod1_0 counter (tod10ct) n tod1_1 counter (tod11ct) n tod1_2 counter (tod12ct) n tod1_3 counter (tod13ct) n tod1_4 counter (tod14ct) n tod1_5 counter (tod15ct) n tod1_6 counter (tod16ct) n tod1_7 counter (tod17ct) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tod10ct - tod17ct d bit name function r w 0 - 15 tod10ct - tod17ct 16-bit counter value w = : write to this register is accepted in all but pwm output mode. note: this register must always be accessed in halfwords. the tod1 counter is a 16-bit down-counter. after the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it starts counting synchronously with the count clock. during pwm output mode, this counter is disabled against write.
10 10-184 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.6 tod reload 0 registers n tod0_0 reload 0 register (tod00rl0) n tod0_1 reload 0 register (tod01rl0) n tod0_2 reload 0 register (tod02rl0) n tod0_3 reload 0 register (tod03rl0) n tod0_4 reload 0 register (tod04rl0) n tod0_5 reload 0 register (tod05rl0) n tod0_6 reload 0 register (tod06rl0) n tod0_7 reload 0 register (tod07rl0) d01234567891011121314d15 tod00rl0 - tod07rl0 d bit name function r w 0 - 15 tod00rl0 - tod07rl0 16-bit reload register value note: this register must always be accessed in halfwords. the tod0 reload 0 register is used to reload the tod0 counter registers (tod00ct-tod07ct) with data. it is in the following cases that the content of reload 0 register is loaded into the counter: ? when the counter is enabled in single-shot output or pwm output mode ? when the counter underflowed in delayed single-shot output or continuous output mode ? when the count value set by reload 1 register underflowed in pwm output mode writing data to the reload 0 register does not mean that the data is loaded into the counter simultaneously.
10 10-185 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) n tod1_0 reload 0 register (tod10rl0) n tod1_1 reload 0 register (tod11rl0) n tod1_2 reload 0 register (tod12rl0) n tod1_3 reload 0 register (tod13rl0) n tod1_4 reload 0 register (tod14rl0) n tod1_5 reload 0 register (tod15rl0) n tod1_6 reload 0 register (tod16rl0) n tod1_7 reload 0 register (tod17rl0) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tod10rl0 - tod17rl0 d bit name function r w 0 - 15 tod10rl0 - tod17rl0 16-bit reload register value note: this register must always be accessed in halfwords. the tod1 reload 0 register is used to reload the tod1 counter registers (tod10ct-tod17ct) with data. it is in the following cases that the content of reload 0 register is loaded into the counter: ? when the counter is enabled in single-shot output or pwm output mode ? when the counter underflowed in delayed single-shot output or continuous output mode ? when the count value set by reload 1 register underflowed in pwm output mode writing data to the reload 0 register does not mean that the data is loaded into the counter simultaneously.
10 10-186 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.7 tod reload 1 registers n tod0_0 reload 1 register (tod00rl1) n tod0_1 reload 1 register (tod01rl1) n tod0_2 reload 1 register (tod02rl1) n tod0_3 reload 1 register (tod03rl1) n tod0_4 reload 1 register (tod04rl1) n tod0_5 reload 1 register (tod05rl1) n tod0_6 reload 1 register (tod06rl1) n tod0_7 reload 1 register (tod07rl1) d01234567891011121314d15 tod00rl1 - tod07rl1 d bit name function r w 0 - 15 tod00rl1 - tod07rl1 16-bit reload register value note: this register must always be accessed in halfwords. the tod0 reload 1 register is used to reload the tod0 counter registers (tod00ct-tod07ct) with data. it is in the following cases that the content of reload 1 register is loaded into the counter: ? when the count value set by reload 0 register underflowed in pwm output mode writing data to the reload 1 register does not mean that the data is loaded into the counter simultaneously.
10 10-187 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) n tod1_0 reload 1 register (tod10rl1) n tod1_1 reload 1 register (tod11rl1) n tod1_2 reload 1 register (tod12rl1) n tod1_3 reload 1 register (tod13rl1) n tod1_4 reload 1 register (tod14rl1) n tod1_5 reload 1 register (tod15rl1) n tod1_6 reload 1 register (tod16rl1) n tod1_7 reload 1 register (tod17rl1) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tod10rl1 - tod17rl1 d bit name function r w 0 - 15 tod10rl1 - tod17rl1 16-bit reload register value note: this register must always be accessed in halfwords. the tod1 reload 1 register is used to reload the tod1 counter registers (tod10ct-tod17ct) with data. it is in the following cases that the content of reload 1 register is loaded into the counter: ? when the count value set by reload 0 register underflowed in pwm output mode writing data to the reload 1 register does not mean that the data is loaded into the counter simultaneously.
10 10-188 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.8 tod enable protect registers n tod0 enable protect register (tod0pro) d8 9 1011121314d15 tod00pro tod01pro tod02pro tod03pro tod04pro tod05pro tod06pro tod07pro d bit name function r w 8 tod00pro 0 : enables rewrite (tod0_0 enable protect) 1 :disables rewrite 9 tod01pro (tod0_1 enable protect) 10 tod02pro (tod0_2 enable protect) 11 tod03pro (tod0_3 enable protect) 12 tod04pro (tod0_4 enable protect) 13 tod05pro (tod0_5 enable protect) 14 tod06pro (tod0_6 enable protect) 15 tod07pro (tod0_7 enable protect) the tod0 enable protect register controls rewriting of the tod0 counter enable bit described in section 10.8.9 by enabling or disabling rewrite.
10 10-189 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) n tod1 enable protect register (tod1pro) d8 9 1011121314d15 tod10pro tod11pro tod12pro tod13pro tod14pro tod15pro tod16pro tod17pro d bit name function r w 8 tod10pro 0 : enables rewrite (tod1_0 enable protect) 1 :disables rewrite 9 tod11pro (tod1_1 enable protect) 10 tod12pro (tod1_2 enable protect) 11 tod13pro (tod1_3 enable protect) 12 tod14pro (tod1_4 enable protect) 13 tod15pro (tod1_5 enable protect) 14 tod16pro (tod1_6 enable protect) 15 tod17pro (tod1_7 enable protect) the tod1 enable protect register controls rewriting of the tod1 counter enable bit described in section 10.8.9 by enabling or disabling rewrite.
10 10-190 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.9 tod cout enable registers n tod0 count enable register (tod0cen) d8 9 1011121314d15 tod00cen tod01cen tod02cen tod03cen tod04cen tod05cen tod06cen tod07cen d bit name function r w 8 tod00cen 0 : stops count (tod0_0 count enable) 1 :enables count 9 tod01cen (tod0_1 count enable) 10 tod02cen (tod0_2 count enable) 11 tod03cen (tod0_3 count enable) 12 tod04cen (tod0_4 count enable) 13 tod05cen (tod0_5 count enable) 14 tod06cen (tod0_6 count enable) 15 tod07cen (tod0_7 count enable) the tod0 count enable register controls operation of tod0 counters. to enable the counter in software, enable the relevant tod0 enable protect register for write and set the count enable bit by writing a 1. to stop the counter, enable the tod0 enable protect register for write and reset the count enable bit by writing a 0. in single-shot output and delayed single-shot output modes, when the counter stops due to an occurrence of underflow, the count enable bit is automatically reset to 0. therefore, what you get by reading the tod0 count enable register is the status that indicates the counter's operating status (active or idle).
10 10-191 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) n tod1 count enable register (tod0cen) d8 9 1011121314d15 tod10cen tod11cen tod12cen tod13cen tod14cen tod15cen tod16cen tod17cen d bit name function r w 8 tod10cen 0 : stops count (tod1_0 count enable) 1 :enables count 9 tod11cen (tod1_1 count enable) 10 tod12cen (tod1_2 count enable) 11 tod13cen (tod1_3 count enable) 12 tod14cen (tod1_4 count enable) 13 tod15cen (tod1_5 count enable) 14 tod16cen (tod1_6 count enable) 15 tod17cen (tod1_7 count enable) the tod1 count enable register controls operation of tod1 counters. to enable the counter in software, enable the relevant tod1 enable protect register for write and set the count enable bit by writing a 1. to stop the counter, enable the tod1 enable protect register for write and reset the count enable bit by writing a 0. in single-shot output and delayed single-shot output modes, when the counter stops due to an occurrence of underflow, the count enable bit is automatically reset to 0. therefore, what you get by reading the tod1 count enable register is the status that indicates the counter's operating status (active or idle).
10 10-192 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.5 configuration of tod0 enable circuit wr dn wr f/f f/f tod0m enable protect (tod0mpro) tod0m enable (tod0mcen) tod0m enable control figure 10.8.6 configuration of tod1 enable circuit wr dn wr en-on f/f f/f f/f tid1 enable output enable (tid1en0) tid1 output tod1m enable protect (tod1mpro) tod1m enable (tod1mcen) tod1m enable control
10 10-193 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.10 operation in tod pwm output mode (1) outline of tod pwm output mode in pwm output mode, the timer uses two reload registers to generate a waveform with a given duty cycle. when after setting the initial values in reload 0 and reload 1 registers, the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it loads the reload 0 register value into the counter synchronously with the count clock letting the counter start counting down. the first time the counter underflows, the reload 1 register value is loaded into the counter letting it continue counting. thereafter, the counter is reloaded with the reload 0 and reload 1 register values alternately each time an underflow occurs. the valid count values are (reload 0 register set value + 1) and (reload 1 register set value + 1). the timer stops at the same time count is disabled by writing to the enable bit (and not in synchronism with pwm output period). the f/f output waveform in pwm output mode is inverted (f/f output levels change from low to high, or vice versa) at count startup and upon each underflow. an interrupt can be generated when the counter underflows every other time (second time, fourth time, and so on) after being enabled. note that tod's pwm output mode does not have the correction function.
10 10-194 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.7 typical operation in pwm output mode h'ffff h'0000 h'a000 h'(c000-1) h'(a000-1) h'c000 h'a000 h'c000 h'a000 f/f output underflow (first time) tod interrupt by underflow underflow (second time) down-count starting from reload 1 register set value data inverted by underflow data inverted by enable reload 1 register down-count starting from reload 0 register set value down-count starting from reload 0 register set value pwm output period enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. data inverted by underflow ~ ~
10 10-195 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) (2) reload register updates in tod pwm output mode in pwm output mode, when the timer remains idle, reload 0 and reload 1 registers are updated at the same time data are written to the registers. but when the timer is active, reload 1 register is updated by updating reload 0 register. however, when you read reload 0 and reload 1 registers, the values you get are always the data written to the registers. figure 10.8.8 pwm circuit diagram if you want to rewrite reload 0 and reload 1 registers while the timer is operating, rewrite reload 1 register first and then reload 0 register. in this way, reload 0 and reload 1 registers both are updated synchronously with pwm periods, from which the timer starts operating again. this operation can normally be performed collectively by accessing register addresses wordwise (in 32 bits) beginning with that of reload 1 register. (data are automatically written to reload 1 and then reload 0 registers in succession.) if you update the reload registers in reverse by updating reload 0 register first and then reload 1 register, only reload 0 register is updated. in this case ?? when you read reload 0 and reload 1 registers, the values you get are always the data written to the registers, and not the reload values being actually used. note that when updating the pwm period, if the pwm period is terminated before you finished writing to reload 0, the pwm period is not updated in the current period and what you've set is reflected in the next period. todnrl1 buffer f/f to todnrl0 internal bus reload 1 reload1wr reload0wr 16-bit counter prescaler output reload 0 pwm mode control
10 10-196 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.9 reload 0 and reload 1 register updates in pwm output mode aaaa aaaa h'0001 h'ffff h'1000 h'7fff h'2000 h'8000 h'9000 h'1000 h'2000 h'8000 h'9000 h'7ffe h'0000 h'2000 h'9000 (a) when reload register updates take effect in the current period (reflected in the next period) note: this diagram does not show detail timing information. count clock reload 0 register reload 1 register counter interrupt by underflow timing at which reload 1 and reload 0 registers are updated new pwm output period operation by new reload value written reload 0 register reload 1 register f/f output write to reload 1 write to reload 0 (reload 1 data latched) enlarged view new pwm output period old pwm output period f/f output pwm period latched reload 1 buffer h'0001 h'ffff h'1000 h'0fff h'2000 h'8000 h'9000 h'1000 h'2000 h'8000 h'9000 h'0ffe h'0000 h'2000 h'9000 (b) when reload register updates take effect in the next period (reflected one period later) note: this diagram does not show detail timing information. count clock reload 0 register reload 1 register counter interrupt by underflow timing at which reload 1 and reload 0 registers are updated old pwm output period operation by old reload value reload 0 register reload 1 register f/f output write to reload 1 write to reload 0 (reload 1 data latched) enlarged view old pwm output period old pwm output period f/f output pwm period latched reload 1 buffer
10 10-197 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.11 operation in tod single-shot output mode (without correction function) (1) outline of tod single-shot output mode in single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once and stops without performing any operation. when after setting the reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it loads the content of reload 0 register into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clock pulses and stops when it underflows after reaching the minimum count. the f/f output waveform in single-shot output mode is inverted (f/f output levels change from low to high, or vice versa) at startup and upon underflow, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once. also, an interrupt can be generated when the counter underflows. the count value is (reload 0 register set value + 1). (for details about count operation, also refer to section 10.3.11, "operation in top single-shot output mode (with correction function)." (2) precautions to be observed when using tod single-shot output mode the following describes precautions to be observed when using tod single-shot output mode. ? if the counter stops due to underflow in the same clock period as the timer is enabled by external input, the former has priority (so that the counter stops). ? if the counter stops due to underflow in the same clock period as count is enabled by writing to the enable bit, the latter has priority (so that countis enabled). ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? because the internal circuit operation is synchronized to the count clock (prescaler output), a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled.
10 10-198 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.10 typical operation in tod single-shot output mode (without correction function) aaaaaaaaaaa aaaaaaaaaaa h'ffff h'0000 h'a000 h'a000 disabled (by underflow) (not used) counts down starting from reload 0 register set value f/f output tod interrupt by underflow data inverted by underflow data inverted by enable reload 1 register enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. ~ ~
10 10-199 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.12 operation in tod delayed single-shot output mode (without correction function) (1) outline of tod delayed single-shot output mode in delayed single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once, with the output delayed by an amount of time equal to (counter set value + 1) and then stops without performing any operation. when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it starts counting down from the counter's set value synchronously with the count clock. the first time the counter underflows, the reload 0 register value is loaded into the counter causing it to continue counting down, and the counter stops when it underflows next time. the f/f output waveform in delayed single-shot output mode is inverted (f/f output levels change from low to high, or vice versa) when the counter underflows first time and next, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once, with the output delayed by an amount of time equal to (first set value of counter + 1). also, an interrupt can be generated when the counter underflows first time and next. the valid count values are the (counter set value + 1) and (reload 0 register set value + 1). for details about count operation, also see section 10.3.12, "operation in top delayed single-shot output mode (with correction function)." (2) precautions to be observed when using tod delayed single-shot output mode the following describes precautions to be observed when using tod delayed single-shot output mode. ? if the counter stops due to underflow in the same clock period as the timer is enabled by external input, the former has priority (so that the counter stops). ? if the counter stops due to underflow in the same clock period as count is enabled by writing to the enable bit, the latter has priority (so that count is enabled). ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? when you read the counter immediately after reloading it pursuant to underflow, the value you get is temporarily h'ffff. but this counter value immediately changes to (reload value - 1) at the next clock edge. ? because the internal circuit operation is synchronized to the prescaler output, a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled.
10 10-200 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.11 typical operation in tod delayed single-shot output mode (without correction function) aaaaaaaaaaaaaaa aaaaaaaaaaaaaaa h'ffff h'0000 h'f000 h'a000 h'f000 h'efff f/f output underflow (first time) tod interrupt by underflow underflow (second time) down-count starting from reload 0 register set value data inverted by underflow reload 1 register down-count starting from counter set value enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. data inverted by underflow (not used) ~ ~ ~ ~
10 10-201 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) 10.8.13 operation in tod continuous output mode (without correction function) (1) outline of tod continuous output mode in continuous output mode, the timer counts down clock pulses starting from the set value of the counter and when the counter underflows, reloads it with reload 0 register value. thereafter, this operation is repeated each time the counter underflows, thus generating consecutive pulses whose waveform is inverted in width of (reload 0 register set value + 1). when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid1 underflow/overflow signal), it starts counting down from the counter's set value synchronously with the count clock and when the minimum count is reached, generates an underflow. this underflow causes the counter to be reloaded with the content of reload 0 register and start counting over again. thereafter, this operation is repeated each time an underflow occurs. to stop the counter, disable count by writing to the enable bit in software. the f/f output waveform in continuous output mode is inverted (f/f output levels change from low to high, or vice versa) at startup and upon underflow, generating consecutive pulses until the timer stops counting. also, an interrupt can be generated each time the counter underflows. the valid count values are the (counter set value + 1) and (reload 0 register set value + 1). for details about count operation, also see section 10.3.11, "operation in top continuous output mode (without correction function)." (2) precautions to be observed when using tod continuous output mode the following describes precautions to be observed when using tod continuous output mode. ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? when you read the counter immediately after reloading it pursuant to underflow, the value you get is temporarily h'ffff. but this counter value immediately changes to (reload value - 1) at the next clock edge. ? because the internal circuit operation is synchronized to the count clock (prescaler output), a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled.
10 10-202 ver.0.10 multijunction timers 10.8 tod (output-related 16-bit timer) figure 10.8.12 typical operation in tod continuous output mode (without correction function) aaaaaaaaaaaaaa aaaaaaaaaaaaaa h'ffff h'0000 h'e000 h'a000 h'e000 h'dfff h'dfff f/f output underflow (first time) underflow (second time) data inverted by underflow data inverted by enable reload 1 register down-count starting from reload 0 register set value enabled (by writing to enable bit or by external input) reload 0 register count clock counter note: this diagram does not show detail timing information. data inverted by underflow down-count starting from counter set value down-count starting from reload 0 register set value (not used)
10 10-203 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9 tom (output-related 16-bit timer) 10.9.1 outline of tom tom (timer output modification) is an output-related 16-bit timer, whose operation mode can be selected from the following by mode switching in software. ? pwm output mode ? single-shot output mode ? single-shot pwm output mode ? continuous output mode the table below shows specifications of tom. the diagram in the next page shows a block diagram of tom. table 10.9.1 specifications of tom (output-related 16-bit timer) item specification number of channels 8 channels counter 16-bit down-counter reload register 16-bit reload register timer startup started by writing to enable bit in software or by tid2 timer underflow/overflow signal mode selection ? pwm output mode ? single-shot output mode ? single-shot pwm output mode ? continuous output mode interrupt generation can be generated by a counter underflow
10 10-204 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.1 tom (output-related 16-bit timer) f/f psc5 clk udf tom0_0 clk udf tom0_1 clk udf tom0_2 clk udf tom0_3 clk udf tom0_4 clk udf tom0_5 clk udf tom0_6 clk udf tom0_7 f/f37 f/f38 f/f39 f/f40 f/f41 f/f42 f/f43 f/f44 irq16 to 37 to 38 to 39 to 40 to 41 to 42 to 43 to 44 psc5 en clk udf tid2 ovf irq17 clk1 clk2 tin28 tin29 : prescaler : output flip-flop 1/2 internal peripheral clock en en en en en en en
10 10-205 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.2 outline of each mode of tom each mode of tom is outlined below. for each tom channel, only one of the following modes can be selected. (1) pwm output mode (without correction function) in pwm output mode, the timer uses two reload registers to generate a waveform with a given duty cycle. when after setting the initial values in reload 0 and reload 1 registers, the timer is enabled (by writing to the enable bit in software or by tid2 underflow/overflow signal), it loads the reload 0 register value into the counter synchronously with the count clock, letting the counter start counting down. the first time the counter underflows, the reload 1 register value is loaded into the counter letting it continue counting. thereafter, the counter is reloaded with the reload 0 and reload 1 register values alternately each time an underflow occurs. the f/f output waveform in pwm output mode is inverted at count startup and upon each underflow. the timer stops at the same time count is disabled by writing to the enable bit (and not in synchronism with pwm output period). an interrupt can be generated when the counter underflows every other time (second time, fourth time, and so on) after being enabled. (2) single-shot output mode (without correction function) in single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once and stops without performing any operation. when after setting the reload 0 register, the timer is enabled (by writing to the enable bit in software or by using tid2 underflow/overflow signal), it loads the content of reload 0 register into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clock pulses and stops when it underflows after reaching the minimum count. the f/f output waveform in single-shot output mode is inverted at startup and upon underflow, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once. also, an interrupt can be generated when the counter underflows.
10 10-206 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) (3) single-shot pwm output mode (without correction function) in single-shot pwm output mode, the timer uses two reload registers to generate a waveform with a given duty cycle only once. when after setting the initial values in reload 0 and reload 1 registers, the timer is enabled (by writing to the enable bit in software or by tid2 underflow/overflow signal), it loads the reload 0 register value into the counter synchronously with the count clock, letting the counter start counting down. the first time the counter underflows, the reload 1 register value is loaded into the counter letting it continue counting. then when the counter underflows next time, it stops. the valid count values are the (reload 0 register set value + 1) and (reload 1 register set value + 1) each. to stop the timer in software, disable count by writing to the enable bit. the timer stops at the same time count is disabled (and not in synchronism with pwm output period). the f/f output waveform in single-shot pwm output mode is inverted (f/f output levels change from low to high, or vice versa) upon each underflow. (unlike in pwm output mode, f/f output is not inverted at counter startup.) an interrupt can be generated when the counter underflows second time after being enabled. (4) continuous output mode (without correction function) in continuous output mode, the timer counts down clock pulses starting from the set value of the counter and when the counter underflows, reloads it with the reload 0 register value. thereafter, this operation is repeated each time the counter underflows, thus generating consecutive pulses in width of (reload 0 register set value + 1). when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid2 underflow/overflow signal), it starts counting down from the counter's set value synchronously with the count clock and when the minimum count is reached, generates an underflow. this underflow causes the counter to be reloaded with the content of reload 0 register and start counting again. thereafter, this operation is repeated each time an underflow occurs. to stop the counter, disable count by writing to the enable bit in software. the f/f output waveform in continuous output mode is inverted at startup and upon underflow, generating consecutive pulses until the timer stops counting. also, an interrupt can be generated each time the counter underflows.
10 10-207 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.3 tom related register map the diagram below shows a tom related register map. figure 10.9.2 tom related register map (1/2) h'0080 0c90 d0 d7 d8 d15 h'0080 0c92 h'0080 0c94 h'0080 0c96 h'0080 0ca0 h'0080 0ca2 h'0080 0ca4 h'0080 0ca6 h'0080 0cb0 h'0080 0cb2 h'0080 0cb4 h'0080 0cb6 h'0080 0cba h'0080 0cbc h'0080 0cbe tom0_1 counter (tom01ct) h'0080 0c9a h'0080 0c98 h'0080 0cb8 tom0_0 reload 0 register (tom00rl0) tom0_0 reload 1 register (tom00rl1) tom0_0 counter (tom00ct) tom0_5 reload 0 register (tom05rl0) tom0_5 reload 1 register (tom05rl1) h'0080 0c9c h'0080 0c9e h'0080 0ca8 h'0080 0caa h'0080 0cac h'0080 0cae +0 address +1 address address note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. tom0_2 counter (tom02ct) tom0_1 reload 0 register (tom01rl0) tom0_1 reload 1 register (tom01rl1) tom0_3 counter (tom03ct) tom0_2 reload 0 register (tom02rl0) tom0_2 reload 1 register (tom02rl1) tom0_4 counter (tom04ct) tom0_3 reload 0 register (tom03rl0) tom0_3 reload 1 register (tom03rl1) tom0_5 counter (tom05ct) tom0_4 reload 0 register (tom04rl0) tom0_4 reload 1 register (tom04rl1)
10 10-208 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.3 tom related register map (2/2) h'0080 0cc0 d0 d7 d8 d15 h'0080 0cc2 h'0080 0cc4 h'0080 0cc6 h'0080 0cd0 h'0080 0cd2 h'0080 0cd4 h'0080 0cd6 h'0080 0cca h'0080 0cc8 tid2 control & prescaler 5 enable register (tid2prs5en) (note 1) h'0080 0ccc h'0080 0cce h'0080 0cd8 prescaler register 5 (prs5) tom0 interrupt mask register (tom0ima) tom0 interrupt status register (tom0ist) f/f protect register 4 (ffp4) f/f data register 4 (ffd4) note 1. prescaler register 5 is shared with tom0_0-7 and tid2, and tid2 control & prescaler 5 enable register is used in tid2 control. h'0080 0cda h'0080 0cdc h'0080 0cde tom0 control register (tom0cr) tom0 enable protect register (tom0pro) tom0 count enable register (tom0cen) blank addresses are reserved. note2: the registers enclosed in thick frames must always be accessed in halfwords. tom0_7 counter (tom07ct) tom0_6 reload 0 register (tom06rl0) tom0_6 reload 1 register (tom06rl1) +0 address +1 address address tom0_6 counter (tom06ct) tom0_7 reload 0 register (tom07rl0) tom0_7 reload 1 register (tom07rl1)
10 10-209 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) d bit name function r w 0,1 tom00m 00: single-shot output mode (tom0_0 operation mode selection) 01: single-shot pwm output mode 2,3 tom01m 10: continuous output mode (tom0_1 operation mode selection) 11: pwm output mode 4,5 tom02m (tom0_2 operation mode selection) 6,7 tom03m (tom0_3 operation mode selection) 8,9 tom04m (tom0_4 operation mode selection) 10,11 tom05m (tom0_5 operation mode selection) 12,13 tom06m (tom0_6 operation mode selection) 14,15 tom07m (tom0_7 operation mode selection) 10.9.4 tom control registers n tom0 control register (tom0cr) the tom0 control register is used to select tom0_0-7 operation modes (pwm output, single- shot output, single-shot pwm output, or continuous output mode). d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tom00m tom01m tom02m tom03m tom04m tom05m tom06m tom07m
10 10-210 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.5 tom counters n tom0_0 counter (tom00ct) n tom0_1 counter (tom01ct) n tom0_2 counter (tom02ct) n tom0_3 counter (tom03ct) n tom0_4 counter (tom04ct) n tom0_5 counter (tom05ct) n tom0_6 counter (tom06ct) n tom0_7 counter (tom07ct) w= : write to this register is not accepted is disabled in pwm output mode. note: this register must always be accessed in halfwords. the tom0 counter is a 16-bit down-counter. after the timer is enabled (by writing to the enable bit in software or by tid2 underflow/overflow signal), it starts counting synchronously with the count clock. during pwm output and single-shot pwm output modes, this counter is disabled against write. d bit name function r w 0-15 tom00ct-tom07ct 16-bit counter value d01234567891011121314d15 tom00ct-tom07ct
10 10-211 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.6 tom reload 0 registers n tom0_0 reload 0 register (tom00rl0) n tom0_1 reload 0 register (tom01rl0) n tom0_2 reload 0 register (tom02rl0) n tom0_3 reload 0 register (tom03rl0) n tom0_4 reload 0 register (tom04rl0) n tom0_5 reload 0 register (tom05rl0) n tom0_6 reload 0 register (tom06rl0) n tom0_7 reload 0 register (tom07rl0) note: this register must always be accessed in halfwords. the tom0 reload 0 registers are used to reload the tom0 counter registers (tom00ct- tom07ct) with data. it is in the following cases that the content of reload 0 register is loaded into the counter: ? when the counter is enabled in single-shot output, pwm output, or single-shot pwm output mode ? when the counter underflowed in continuous output mode ? when the count value set by reload 1 register underflowed in pwm output mode writing data to the reload 0 register does not mean that the data is loaded into the counter simultaneously. d bit name function r w 0-15 tom00rl0-tom07rl0 16-bit reload register value d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tom00rl0-tom07rl0
10 10-212 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.7 tom reload 1 registers n tom0_0 reload 1 register (tom00rl1) n tom0_1 reload 1 register (tom01rl1) n tom0_2 reload 1 register (tom02rl1) n tom0_3 reload 1 register (tom03rl1) n tom0_4 reload 1 register (tom04rl1) n tom0_5 reload 1 register (tom05rl1) n tom0_6 reload 1 register (tom06rl1) n tom0_7 reload 1 register (tom07rl1) note: this register must always be accessed in halfwords. the tom0 reload 1 registers are used to reload the tom0 counter registers (tom00ct- tom07ct) with data. it is in the following cases that the content of reload 1 register is loaded into the counter: ? when the count value set by reload 1 register underflowed in pwm output mode. writing data to the reload 1 register does not mean that the data is loaded into the counter simultaneously. d bit name function r w 0-15 tom00rl1-tom07rl1 16-bit reload register value d01234567891011121314d15 tom00rl1-tom07rl1
10 10-213 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.8 tom enable protect registers n tom0 enable protect register (tom0pro) the tom0 enable protect register controls rewriting of the tom0 counter enable bit described in the next page by enabling or disabling rewrite. d bit name function r w 8 tom00pro 0: enables rewrite (tom0_0 enable protect) 1: disables rewrite 9 tom01pro (tom0_1 enable protect) 10 tom02pro (tom0_2 enable protect) 11 tom03pro (tom0_3 enable protect) 12 tom04pro (tom0_4 enable protect) 13 tom05pro (tom0_5 enable protect) 14 tom06pro (tom0_6 enable protect) 15 tom07pro (tom0_7 enable protect) d8 9 1011121314d15 tom00pro tom01pro tom02pro tom03pro tom04pro tom05pro tom06pro tom07pro
10 10-214 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.9 tom count enable registers n tom0 count enable register (tom0cen) d8 9 1011121314d15 tom00cen tom01cen tom02cen tom03cen tom04cen tom05cen tom06cen tom07cen d bit name function r w 8 tom00cen 0: stops count (tom0_0 count enable) 1: enables count 9 tom01cen (tom0_1 count enable) 10 tom02cen (tom0_2 count enable) 11 tom03cen (tom0_3 count enable) 12 tom04cen (tom0_4 count enable) 13 tom05cen (tom0_5 count enable) 14 tom06cen (tom0_6 count enable) 15 tom07cen (tom0_7 count enable) the tom0 count enable register controls operation of tom0 counters. to enable the counter in software, enable the relevant tom0 enable protect register for write and set the count enable bit by writing a 1. to stop the counter, enable the tom0 enable protect register for write and reset the count enable bit by writing a 0. in single-shot output and single-shot pwm output modes, when the counter stops due to an occurrence of underflow, the count enable bit is automatically reset to 0. therefore, what you get by reading the tom0 count enable register is the status that indicates the counter's operating status (active or idle).
10 10-215 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.4 configuration of the tom enable circuit wr dn wr en-on tid2 enable output enable (tid2en0) f/f f/f f/f tid2 output tom0m enable protect (tom0mpro) tom0m enable (tom0mcen) tom0m enable control
10 10-216 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.10 operation in tom pwm output mode (1) outline of tom pwm output mode in pwm output mode, the timer uses two reload registers to generate a waveform with a given duty cycle. when after setting the initial values in reload 0 and reload 1 registers, the timer is enabled (by writing to the enable bit in software or by tid2 underflow/overflow signal), it loads the reload 0 register value into the counter synchronously with the count clock letting the counter start counting down. the first time the counter underflows, the reload 1 register value is loaded into the counter letting it continue counting. thereafter, the counter is reloaded with the reload 0 and reload 1 register values alternately each time an underflow occurs. the valid count values are (reload 0 register set value + 1) and (reload 1 register set value + 1). the timer stops at the same time count is disabled by writing to the enable bit (and not in synchronism with pwm output period). the f/f output waveform in pwm output mode is inverted (f/f output levels change from low to high, or vice versa) at count startup and upon each underflow. an interrupt can be generated when the counter underflows every other time (second time, fourth time, and so on) after being enabled. note that tom's pwm output mode does not have the correction function.
10 10-217 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.5 typical operation in pwm output mode h'ffff h'0000 h'a000 h'(c000-1) h'(a000-1) h'c000 h'a000 h'c000 h'a000 f/f output underflow (first time) tom interrupt by underflow underflow (second time) down-count starting from reload 1 register set value data inverted by underflow data inverted by enable reload 1 register down-count starting from reload 0 register set value pwm output period enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. data inverted by underflow down-count starting from reload 0 register set value ~ ~
10 10-218 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) (2) reload register updates in tom pwm output mode in pwm output mode, when the timer remains idle, reload 0 and reload 1 registers are updated at the same time data are written to the registers. but when the timer is active, reload 1 register is updated by updating reload 0 register. however, when you read reload 0 and reload 1 registers, the values you get are always the data written to the registers. figure 10.9.6 pwm circuit diagram if you want to rewrite reload 0 and reload 1 registers while the timer is operating, rewrite reload 1 register first and then reload 0 register. in this way, reload 0 and reload 1 registers both are updated synchronously with pwm periods, from which the timer starts operating again. this operation can normally be performed collectively by accessing register addresses wordwise (in 32 bits) beginning with that of reload 1 register. (data are automatically written to reload 1 and then reload 0 registers in succession.) if you update the reload registers in reverse by updating reload 0 register first and then reload 1 register, only reload 0 register is updated. when you read reload 0 and reload 1 registers, the values you get are always the data written to the registers, and not the reload values being actually used. note that when updating the pwm period, if the pwm period is terminated before you finished writing to reload 0, the pwm period is not updated in the current period and what you've set is reflected in the next period. tom0nrl1 buffer f/f to tom0nrl0 internal bus reload 1 reload1wr reload0wr 16-bit counter prescaler output reload 0 pwm mode control
10 10-219 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.7 reload 0 and reload 1 register updates in pwm output mode aaaaa aaaaa h'0001 h'ffff h'1000 h'7fff h'2000 h'8000 h'9000 h'1000 h'2000 h'8000 h'9000 h'7ffe h'0000 h'2000 h'9000 (a) when reload register updates take effect in the current period (reflected in the next period) note: this diagram does not show detail timing information. count clock reload 0 register reload 1 register counter interrupt by underflow timing at which reload 1 and reload 0 registers are updated new pwm output period operation by new reload value written reload 0 register reload 1 register f/f output write to reload 1 write to reload 0 (reload 1 data latched) enlarged view new pwm output period old pwm output period f/f output pwm period latched reload 1 buffer h'0001 h'ffff h'1000 h'0fff h'2000 h'8000 h'9000 h'1000 h'2000 h'8000 h'9000 h'0ffe h'0000 h'2000 h'9000 (b) when reload register updates take effect in the next period (reflected one period later) note: this diagram does not show detail timing information. count clock reload 0 register reload 1 register counter interrupt by underflow timing at which reload 1 and reload 0 registers are updated old pwm output period operation by old reload value reload 0 register reload 1 register f/f output write to reload 1 write to reload 0 (reload 1 data latched) enlarged view old pwm output period old pwm output period f/f output pwm period latched reload 1 buffer
10 10-220 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.11 operation in tom single-shot output mode (without correction function) (1) outline of tom single-shot output mode in single-shot output mode, the timer generates a pulse in width of (reload 0 register set value + 1) only once and stops without performing any operation. when after setting the reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid2 underflow/overflow signal), it loads the content of reload 0 register into the counter synchronously with the count clock, letting the counter start counting. the counter counts down clock pulses and stops when it underflows after reaching the minimum count. the f/f output waveform in single-shot output mode is inverted (f/f output levels change from low to high, or vice versa) at startup and upon underflow, generating a single-shot pulse waveform in width of (reload 0 register set value + 1) only once. also, an interrupt can be generated when the counter underflows. the count value is (reload 0 register set value + 1). (for details about count operation, also refer to section 10.3.11, "operation in top single-shot output mode (with correction function)." (2) precautions to be observed when using tom single-shot output mode the following describes precautions to be observed when using tom single-shot output mode. ? if the counter stops due to underflow in the same clock period as the timer is enabled by external input, the former has priority (so that the counter stops). ? if the counter stops due to underflow in the same clock period as count is enabled by writing to the enable bit, the latter has priority (so that count is enabled). ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? because the internal circuit operation is synchronized to the count clock (prescaler output), a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled.
10 10-221 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.8 typical operation in tom single-shot output mode (without correction function) aaaaaaaaaaa aaaaaaaaaaa h'ffff h'0000 h'a000 h'a000 disabled (by underflow) (not used) counts down starting from reload 0 register set value f/f output tom interrupt by underflow data inverted by underflow data inverted by enable reload 1 register enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. ~ ~
10 10-222 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.12 operation in tom single-shot pwm output mode (without correction function) (1) outline of tom single-shot pwm output mode in single-shot pwm output mode, the timer uses two reload registers to generate a waveform with a given duty cycle only once. when after setting the initial values in reload 0 and reload 1 registers, the timer is enabled (by writing to the enable bit in software or by tid2 underflow/overflow signal), it loads the reload 0 register value into the counter synchronously with the count clock, letting the counter start counting down. the first time the counter underflows, the reload 1 register value is loaded into the counter letting it continue counting. then when the counter underflows next time, it stops. the valid count values are the (reload 0 register set value + 1) and (reload 1 register set value + 1) each. to stop the timer in software, disable count by writing to the enable bit. the timer stops at the same time count is disabled (and not in synchronism with pwm output period). the f/f output waveform in single-shot pwm output mode is inverted (f/f output levels change from low to high, or vice versa) upon each underflow. (unlike in pwm output mode, f/f output is not inverted at counter startup.) an interrupt can be generated when the counter underflows second time after being enabled. note that tom's single-shot pwm output mode does not have the correction function.
10 10-223 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.9 typical operation in tom single-shot pwm output mode (without correction function) aaaaaaaaaaaaaaa h'ffff h'0000 h'a000 h'a000 h'f000 h'efff h'f000 f/f output underflow (first time) tom interrupt by underflow underflow (second time) down-count starting from reload 1 register set value data inverted by underflow reload 1 register down-count starting from reload 0 register set value pwm output period enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. data inverted by underflow ~ ~
10 10-224 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.13 operation in tom continuous output mode (without correction function) (1) outline of tom continuous output mode in continuous output mode, the timer counts down clock pulses starting from the set value of the counter and when the counter underflows, reloads it with reload 0 register value. thereafter, this operation is repeated each time the counter underflows, thus generating consecutive pulses whose waveform is inverted in width of (reload 0 register set value + 1). when after setting the counter and reload 0 register, the timer is enabled (by writing to the enable bit in software or by tid2 underflow/overflow signal), it starts counting down from the counter's set value synchronously with the count clock and when the minimum count is reached, generates an underflow. this underflow causes the counter to be reloaded with the content of reload 0 register and start counting over again. thereafter, this operation is repeated each time an underflow occurs. to stop the counter, disable count by writing to the enable bit in software. the f/f output waveform in continuous output mode is inverted (f/f output levels change from low to high, or vice versa) at startup and upon underflow, generating consecutive pulses until the timer stops counting. also, an interrupt can be generated each time the counter underflows. the valid count values are the (counter set value + 1) and (reload 0 register set value + 1). for details about count operation, also see section 10.3.11, "operation in top continuous output mode (without correction function)." (2) precautions to be observed when using tom continuous output mode the following describes precautions to be observed when using tom continuous output mode. ? if the timer is enabled by external input in the same clock period as count is disabled by writing to the enable bit, the latter has priority (so that count is disabled). ? when you read the counter immediately after reloading it pursuant to underflow, the value you get is temporarily h'ffff. but this counter value immediately changes to (reload value - 1) at the next clock edge. ? because the internal circuit operation is synchronized to the count clock (prescaler output), a finite time equal to a prescaler delay is included before f/f starts operating after the timer is enabled.
10 10-225 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.10 typical operation in tom continuous output mode (without correction function) aaaaaaaaaaaaaa h'ffff h'0000 h'e000 h'a000 h'e000 h'dfff h'dfff (not used) f/f output underflow (first time) tom interrupt by underflow underflow (second time) data inverted by underflow data inverted by enable reload 1 register enabled (by writing to enable bit or by external input) reload 0 register count clock counter enable bit note: this diagram does not show detail timing information. data inverted by underflow down-count starting from counter set value down-count starting from reload 0 register set value down-count starting from reload 0 register set value ~ ~ ~ ~
10 10-226 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) 10.9.14 example application for using the 32170 in motor control the 16-bit timer tom incorporated in the 32170 helps to reduce software burdens during motor control. the following shows an example application for using the 32170 in motor control. the three-phase motor control waveform is materialized by starting tom in 20 khz fixed cycles generated by tid2. the new single-shot pwm output function of tom enables the output waveform to be configured easily by storing waveform data only when the data needs to be rewritten. note that the high/low transistor shorting prevention time can be provided by changing the set time of tom in software. figure 10.9.11 system configuration diagram figure 10.9.12 timer connections when used for three-phase motor control circuit board m32r/e#4 power-mos motor u /u v /v w /w tms tms tms tom tom tom tom tom tom clk clk clk clk clk clk f/f37 f/f38 f/f39 f/f40 f/f41 f/f42 tom(u) psc5 en en en en en en clk tid2 single-shot pwm tom0_0 fixed cycle udf udf udf udf udf udf udf tom(/u) tom(v) tom(/v) tom(w) tom(/w) 20 khz generated startup single-shot pwm tom0_1 single-shot pwm tom0_2 single-shot pwm tom0_3 single-shot pwm tom0_4 single-shot pwm tom0_5
10 10-227 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) figure 10.9.13 diagram of control image single-shot u v w 20khz tom start tom(u) tom(/u) tom(v) tom(/v) tom(w) tom(/w) delay delay single-shot : shorting prevention time
10 10-228 ver.0.10 multijunction timers 10.9 tom (output-related 16-bit timer) j this is a blank page. j
chapter 11 a-d converters 11.1 outline of a-d converters 11.2 a-d converter related registers 11.3 functional description of a-d converters 11.4 precautions on using a-d converters
11 11-2 ver.0.10 a-d converters 11.1 outline of a-d converters 11.1 outline of a-d converter the 32170 contains two 10-bit a-d converters of a successive approximation type (a-d0 and a-d1 converters). these converters have 32 analog input pins (channels) ad0in0 to ad0in15 and ad1in0 to ad1in 15. the a-d conversion results can be read out in either 8 bits or 10 bits. for a-d conversion, there are following conversion modes and operation modes: (1) conversion mode a-d conversion mode: ordinary mode in which analog input voltages are converted into digital quantities. comparator mode (note): a mode in which analog input voltage is compared with a preset comparison voltage to only find the relative magnitude of two quantities. (single mode only) (2) operation mode single mode: analog input voltage in one channel is a-d converted once or comparated(note) with a given quantity. scan mode: analog input voltages in multiple selected channels (4, 8, or 16 channels) are sequentially a-d converted. (3) types of scan modes single-shot scan mode: scan operation is performed for one machine cycle. continuous scan mode: scan operation is performed repeatedly until stopped. (4) special operation mode forcible single mode execution during scan mode: conversion is forcibly executed in single mode during scan operation. scan mode start after single mode execution: scan operation is started subsequently after executing conversion in single mode. conversion restart: a-d conversion being executed in single or scan mode is restarted. the a-d conversion and comparate rates can be selected between normal and double rate. an a- d conversion interrupt request or a dma transfer request (for the a-d0 converter only) can be generated at completion of a-d conversion, comparate operation, single-shot scan operation, or one cycle of continuous scan operation. note: to discriminate between the comparison operation performed internally by the successive approximation-type a-d converter and the operation in comparator mode performed using the a-d converter as a comparator, the comparison operation in comparator mode in this manual is referred to as "comparate."
11 11-3 ver.0.10 table 11.1.1 outlines the a-d converters. figures 11.1.1 and 11.1.2 show block diagrams of a-d0 and a-d1 converters, respectively. table 11.1.1 outline of a-d converters item content analog input 16 channels x 2 a-d conversion method successive approximation method resolution 10 bits (conversion results can be read out in either 8 bits or 10 bits) nonlinearity error (note1) (conditions: normal rate mode ?lsb ta = 25?, avcc0,1=vref0,1=5.12v) double rate mode ?lsb conversion mode a-d conversion mode, comparator mode operation mode single mode, scan mode scan mode single-shot scan mode, continuous scan mode conversion start trigger software start started by setting a-d converter start bit to 1 hardware start a-d0 converter started by mjt output event bus 3, a-d1 converter started by tid1 overflow or underflow (note 2) __________ started by external adtrg pin input conversion rate during single mode normal rate 299 1/f(bclk) (note 3) f(bclk): (shortest time) double rate 173 1/f(bclk) internal peripheral clock during comparator mode normal rate 47 1/f(bclk) operating frequency (shortest time) double rate 29 1/f(bclk) interrupt request generation function generated at completion of a-d conversion, comparate operation, single-shot scan operation, or one cycle of continuous scan operation dma transfer request generation generated at completion of a-d conversion, comparate operation, function (note 4) single-shot scan operation, or one cycle of continuous scan operation note 1: the nonlinearity error is a deviation from ideal conversion characteristics after the offset and full-scale errors are adjusted to 0. note 2: refer to chapter 10, "multijunction timers." note 3: when bclk = 20 mhz, this is 1/f(bclk) = 50 ns. note 4: the dma transfer request generation function is available for only the a-d0 converter. the a-d1 converter does not have this function. a-d converters 11.1 outline of a-d converters
11 11-4 ver.0.10 figure 11.1.1 block diagram of a-d0 converter a-d converters 11.1 outline of a-d converters ad0in0 ad0in1 ad0in2 ad0in3 ad0in4 ad0in5 ad0in6 ad0in7 selector interrupt request avss0 vref0 10-bit a-d successive approximation register (ad0sar) 10-bit a-d0 data register 0 10-bit a-d0 data register 1 a-d0 single mode register a-d comparate data register a-d control circuit mode selection channel selection conversion time selection flag control interrupt control 10-bit a-d converter comparator ad0in8 ad0in9 ad0n10 ad0in11 ad0in12 ad0in13 ad0in14 ad0in15 ad0cmp ad0dt0 ad0dt1 ad0dt2 ad0dt3 ad0dt4 ad0dt5 ad0dt6 ad0dt7 ad0dt8 ad0dt9 ad0dt10 ad0dt11 ad0dt12 ad0dt13 ad0dt14 ad0dt15 dma transfer request successive approximation -type a-d converter unit internal data bus a-d0 scan mode register p67/adtrg ad0scm0,1 ad0sim0,1 avcc0 output event bus 3 (multijunction timer) 10-bit readout 8-bit readout shifter 10-bit a-d0 data register 2 10-bit a-d0 data register 3 10-bit a-d0 data register 4 10-bit a-d0 data register 5 10-bit a-d0 data register 6 10-bit a-d0 data register 7 10-bit a-d0 data register 8 10-bit a-d0 data register 9 10-bit a-d0 data register 10 10-bit a-d0 data register 11 10-bit a-d0 data register 12 10-bit a-d0 data register 13 10-bit a-d0 data register 14 10-bit a-d0 data register 15
11 11-5 ver.0.10 figure 11.1.2 block diagram of a-d0 converter a-d converters 11.1 outline of a-d converters ad1in0 ad1in1 ad1in2 ad1in3 ad1in4 ad1in5 ad1in6 ad1in7 avss1 vref1 ad1in8 ad1in9 ad1n10 ad1in11 ad1in12 ad1in13 ad1in14 ad1in15 ad1cmp ad1dt0 ad1dt1 ad1dt2 ad1dt3 ad1dt4 ad1dt5 ad1dt6 ad1dt7 ad1dt8 ad1dt9 ad1dt10 ad1dt11 ad1dt12 ad1dt13 ad1dt14 ad1dt15 p67/adtrg ad1scm0,1 ad1sim0,1 avcc1 tid1 underflow /overflow 10-bit a-d1 data register 0 10-bit a-d1 data register 1 a-d1 single mode register a-d comparate data register internal data bus a-d1 scan mode register 10-bit readout shifter 10-bit a-d1 data register 2 10-bit a-d1 data register 3 10-bit a-d1 data register 4 10-bit a-d1 data register 5 10-bit a-d1 data register 6 10-bit a-d1 data register 7 10-bit a-d1 data register 8 10-bit a-d1 data register 9 10-bit a-d1 data register 10 10-bit a-d1 data register 11 10-bit a-d1 data register 12 10-bit a-d1 data register 13 10-bit a-d1 data register 14 10-bit a-d1 data register 15 selector interrupt request 10-bit a-d successive approximation register (ad1sar) a-d control circuit mode selection channel selection conversion time selection flag control interrupt control 10-bit a-d converter comparator successive approximation -type a-d converter unit 8-bit readout
11 11-6 ver.0.10 11.1.1 conversion modes the a-d converters have two conversion modes: "a-d conversion mode" and "comparator mode." (1) a-d conversion mode in a-d conversion mode, the analog input voltage in a specified channel is converted into digital quantity. in single mode, a-d conversion is performed on a channel selected by the single mode register 1 analog input pin select bit. in scan mode, a-d conversion is performed on channels selected by scan mode register 1 according to settings of scan mode register 0. the conversion result is stored in each channel's corresponding 10-bit a-d data register. also, 8-bit a-d conversion results can be read from each 8-bit a-d data register. an a-d conversion interrupt request or a dma transfer request (for the a-d0 converter only) can be generated at completion of a-d conversion when in single mode, or when operating in scan mode, at completion of one cycle of scan loop. (2) comparator mode in comparator mode, the analog input voltage in a specified channel is "comparated" (compared) with the successive approximation register value, and the result (relative magnitude of two values) is returned to a flag. the channel to be comparated is selected using the single mode register 1 analog input pin select bit. the result of comparate operation is flagged (1 or 0) by setting or resetting the a-d comparate data register bit that corresponds to the selected channel. an a-d conversion interrupt request or a dma transfer request (for the a-d0 converter only) can be generated at completion of comparate operation. a-d converters 11.1 outline of a-d converters
11 11-7 ver.0.10 11.1.2 operation modes the a-d converters operate in two modes: "single mode" and "scan mode." (1) single mode in single mode, the analog input voltage in one selected channel is a-d converted once or comparated with a given quantity. an a-d conversion interrupt request or a dma transfer request (for the a-d0 converter only) can be generated at completion of a-d conversion. figure 11.1.3 operation in single mode (a-d conversion) figure 11.1.4 operation in single mode (comparate) note 1: a-d0 conversion start: software trigger started by setting a-d0 conversion start bit to 1 ____________ hardware trigger started by output event bus 3 or adtrg signal input a-d1 conversion start: software trigger started by setting a-d1 conversion start bit to 1 ____________ hardware trigger started by tid1 overflow/underflow or adtrg signal input note 2: dma transfer request: can be generated for only the a-d0 converter. note 1: comparate start: started by writing a comparison value to the successive approximation register (adisar) note 2: dma transfer request: can be generated for only the a-d0 converter. a-d converters 11.1 outline of a-d converters a-d conversion interrupt request or dma transfer request (note 2) aniinn completed adidtn 10-bit a-di data register conversion starts (note 1) i=0,1 n=0-15 adiinn adicmp a-di comparate data register adisar a-d successive approximation register comparate result adicmp=0 (ann>adisar) adicmp=1 (ann 11 11-8 ver.0.10 (2) scan mode in scan mode, analog input voltages in multiple selected channels (4, 8, or 16 channels) are sequentially a-d converted. there are two types of scan modes: "single-shot scan mode" in which a-d conversion is completed by performing one cycle of scan operation, and "continuous scan mode" in which scan operation is continued until halted by setting the scan mode register a-d conversion stop bit to 1. these types of scan modes are selected using scan mode register 0. the channels to be scanned are selected using scan mode register 1. the number of channels and the sequence to be scanned can be selected from three combinations available: 4, 8, or 16 channels. channels adiin0 to adiin3 (i = 0, 1) are used for 4-channel scan. similarly, channels adiin0 to adiin7 and channels adiin0 to adiin15 are used for 8-channel scan and 16-channel scan, respectively. an a-d conversion interrupt request or a dma transfer request (for the a-d0 converter only) can be generated at completion of one cycle of scan operation. figure 11.1.5 operation of a-d conversion in scan mode (for 4-channel scan) note 1: a-d0 conversion start: software trigger started by setting a-d0 conversion start bit to 1 ____________ hardware trigger started by output event bus 3 or adtrg signal input a-d1 conversion start: software trigger started by setting a-d1 conversion start bit to 1 ____________ hardware trigger started by tid1 overflow/underflow or adtrg signal input note 2: dma transfer request: can be generated for only the a-d0 converter. a-d converters 11.1 outline of a-d converters adiin0 completed here when operating in single-shot scan mode adidt0 10-bit a-di data register adiin1 adiin2 adiin3 adidt1 adidt2 adidt3 during continuous scan mode <4-channel scan> i=0,1 a-d conversion interrupt request or dma transfer request (note 2) conversion starts (note 1)
11 11-9 ver.0.10 figure 11.1.6 operation of a-d conversion in scan mode (for 8-channel/16-channel scan) note 1: a-d0 conversion start: software trigger started by setting a-d0 conversion start bit to 1 ____________ hardware trigger started by output event bus 3 or adtrg signal input a-d1 conversion start: software trigger started by setting a-d1 conversion start bit to 1 ____________ hardware trigger started by tid1 overflow/underflow or adtrg signal input note 2: dma transfer request: can be generated for only the a-d0 converter. a-d converters 11.1 outline of a-d converters adiin0 adidt0 adiin1 adiin2 adiin3 adidt1 adidt2 adidt3 adiin4 adidt4 adiin5 adiin6 adiin7 adidt5 adidt6 adidt7 adiin0 adidt0 adiin1 adiin2 adiin3 adidt1 adidt2 adidt3 adiin4 adidt4 adiin5 adiin6 adiin7 adidt5 adidt6 adidt7 adiin8 adidt8 adiin9 adiin10 adiin11 adidt9 adidt10 adidt11 adiin12 adidt12 adiin13 adiin14 adiin15 adidt13 adidt14 adidt15 i=0,1 completed here when operating in single-shot scan mode 10-bit a-di data register during continuous scan mode <8-channel scan> a-d conversion interrupt request or dma transfer request (note 2) conversion starts (note 1) completed here when operating in single-shot scan mode 10-bit a-di data register during continuous scan mode <16-channel scan> conversion starts (note 1)
11 11-10 ver.0.10 table 11.1.2 registers in which scan mode a-d conversion results are stored scan loop selected channels selected channels a-d conversion result selection for single-shot scan for continue scan storage register 4-channel scan adiin0 adiin0 10-bit a-di data register 0 adiin1 adiin1 10-bit a-di data register 1 adiin2 adiin2 10-bit a-di data register 2 adiin3 adiin3 10-bit a-di data register 3 completed adiin0 10-bit a-di data register 0 (repeated until forcibly halted) 8-channel scan adiin0 adiin0 10-bit a-di data register 0 adiin1 adiin1 10-bit a-di data register 1 adiin2 adiin2 10-bit a-di data register 2 adiin3 adiin3 10-bit a-di data register 3 adiin4 adiin4 10-bit a-di data register 4 adiin5 adiin5 10-bit a-di data register 5 adiin6 adiin6 10-bit a-di data register 6 adiin7 adiin7 10-bit a-di data register 7 completed adiin0 10-bit a-di data register 0 (repeated until forcibly halted) 16-channel scan adiin0 adiin0 10-bit a-di data register 0 adiin1 adiin1 10-bit a-di data register 1 adiin2 adiin2 10-bit a-di data register 2 adiin3 adiin3 10-bit a-di data register 3 adiin4 adiin4 10-bit a-di data register 4 adiin5 adiin5 10-bit a-di data register 5 adiin6 adiin6 10-bit a-di data register 6 adiin7 adiin7 10-bit a-di data register 7 adiin8 adiin8 10-bit a-di data register 8 adiin9 adiin9 10-bit a-di data register 9 adiin10 adiin10 10-bit a-di data register 10 adiin11 adiin11 10-bit a-di data register 11 adiin12 adiin12 10-bit a-di data register 12 adiin13 adiin13 10-bit a-di data register 13 adiin14 adiin14 10-bit a-di data register 14 adiin15 adiin15 10-bit a-di data register 15 completed adiin0 10-bit a-d data register 0 (repeated until forcibly halted) (i=0, 1) a-d converters 11.1 outline of a-d converters
11 11-11 ver.0.10 11.1.3 special operation modes (1) forcible single mode execution during scan mode this special operation mode forcibly executes single mode conversion (a-d conversion or comparate) in a specified channel during scan mode operation. for a-d conversion mode, the conversion result is stored in the 10-bit a-d data register corresponding to the specified channel. for comparate mode, the conversion result is stored in the 10-bit a-d comparate data register. when the a-d conversion or comparate operation in the specified channel is completed, scan mode a-d conversion is restarted from where it was canceled during scan operation. to start single mode conversion during scan mode operation in software, choose a software trigger using the single mode register 0 a-d conversion start trigger select bit. then, for a-d conversion, set the said register's a-d conversion start bit to 1, or for comparate mode, write a comparison value to the a-d successive approximation register (ad0sar or ad1sar) during scan mode operation. to start single mode conversion during scan mode operation in hardware, choose a hardware trigger using the single mode register 0 a-d conversion start trigger select bit. then enter the ____________ hardware trigger selected with the said register (adtrg signal or output event bus 3 for the a-d0 ____________ converter, or adtrg signal or tid1 overflow/underflow for the a-d1 converter). an a-d conversion interrupt request or a dma transfer request (for the a-d0 converter only) can be generated at completion of conversion in the specified channel, or at completion of one cycle of scan operation. figure 11.1.7 forcible single mode execution during scan mode note 1: the canceled convert operation in channel 2 is reexecuted from the beginning. note 2: dma transfer request: can be generated for only the a-d0 converter. a-d converters 11.1 outline of a-d converters aa aa a-d conversion interrupt request or dma transfer request (note 2) adiin0 adidt0 10-bit a-di data register scan mode conversion starts adiin1 adidt1 adidt5 completed adiin2 adiin3 adidt2 adidt3 adiin5 forcible single mode execution starts (note 1) adiin2 i=0,1
11 11-12 ver.0.10 (2) scan mode start after single mode execution this special operation mode starts scan operation subsequently after executing conversion in single mode (a-d conversion or comparate). to start this mode in software, choose a software trigger using the scan mode register 0 a-d conversion start trigger select bit. then set the said register's a-d conversion start bit to 1 during single mode conversion operation. to start this mode in hardware, choose a hardware trigger using the scan mode register 0 a-d conversion start trigger select bit. then enter the hardware trigger selected with the said register ____________ ____________ (adtrg signal or output event bus 3 for the a-d0 converter, or adtrg signal or tid1 overflow/ underflow for the a-d1 converter). if after selecting a hardware trigger using the a-d conversion start trigger select bit in both single ____________ mode register 0 and scan mode register 0, you enter a hardware trigger (adtrg signal or ____________ output event bus 3 for the a-d0 converter, or adtrg signal or tid1 overflow/underflow for the a- d1 converter), the device first performs single mode conversion and then scan mode conversion subsequently after executing the single mode conversion. an a-d conversion interrupt request or a dma transfer request (for the a-d0 converter only) can be generated at completion of single mode conversion in the specified channel, or at completion of one cycle of scan operation. figure 11.1.8 scan mode start after single mode execution note : dma transfer request: can be generated for only the a-d0 converter. a-d converters 11.1 outline of a-d converters adiin0 adidt0 instructed to start scan mode conversion adiin1 adidt1 adidt5 adiin2 adiin3 adidt2 adidt3 adiin5 single mode conversion starts i=0,1 a-d conversion interrupt request or dma transfer request (note) 10-bit a-di data register completed
11 11-13 ver.0.10 (3) conversion restart this special operation mode stops operation being executed in single mode or scan mode and reexecutes the operation from the beginning. when in single mode, set the single mode register 0 a-d conversion start bit to 1 again or enter ____________ ____________ a hardware trigger (adtrg signal or output event bus 3 for the a-d0 converter, or adtrg signal or tid1 overflow/underflow for the a-d1 converter) during scan or comparate operation, and the operation being executed is halted and reexecuted from the beginning. when in scan mode, set the single mode register 0 a-d conversion start bit to 1 again or enter ____________ ____________ a hardware trigger (adtrg signal or output event bus 3 for the a-d0 converter, or adtrg signal or tid1 overflow/underflow for the a-d1 converter) during scan or comparate operation, and the channel being converted is canceled and a-d conversion is reexecuted beginning with channel 0. figure 11.1.9 restarting conversion during single mode operation figure 11.1.10 restarting conversion during scan operation note : dma transfer request: can be generated for only the a-d0 converter. a-d converters 11.1 outline of a-d converters aa aa single mode adiin5 conversion starts adidt5 single mode adiin5 conversion restarts adiin5 adiin5 i=0,1 a-d conversion interrupt request or dma transfer request (note) 10-bit a-di data register completed aa aa adiin0 adidt0 scan mode conversion starts adiin1 adidt1 adiin2 adiin3 adidt2 adidt3 scan mode restarts adiin2 adiin0 adidt0 adiin1 adidt1 i=0,1 a-d conversion interrupt request or dma transfer request (note) 10-bit a-di data register completed note : dma transfer request: can be generated for only the a-d0 converter.
11 11-14 ver.0.10 11.1.4 a-d converter interrupt and dma transfer requests the a-d converters can generate an a-d conversion interrupt request or a dma transfer request (for the a-d0 converter only) each time a-d conversion, comparate operation, single-shot scan, or one cycle of continuous scan mode is completed. single mode register 0 and scan mode register 0 are used to select between an a-d conversion interrupt request and a dma transfer request (for the a-d0 converter only). note: for the a-d1 converter, this bit selects to enable or disable interrupt requests and cannot select dma transfer requests. figure 11.1.11 selecting between interrupt request and dma transfer request a-d converters 11.1 outline of a-d converters scan mode (when one cycle of scan completed) single mode (when a-d conversion or comparate operation completed) a-d0 conversion interrupt request (to the interrupt controller) dma transfer request (to the dmac) a-d0 scan mode register 0 interrupt request /dma transfer request select bit (note) a-d0 single mode register 0 interrupt request /dma transfer request select bit (note)
11 11-15 ver.0.10 11.2 a-d converter related registers the diagrams below show an a-d converter related register map. figure 11.2.1 a-d converter related register map (1/4) a-d converters 11.2 a-d converter related registers h'0080 0084 h'0080 0086 h'0080 0088 h'0080 008a h'0080 008c h'0080 0080 h'0080 0082 a-d0 single mode register 0 (ad0sim0) address d0 d7 +0 address +1 address d8 d15 10-bit a-d0 data register 0 (ad0dt0) a-d0 scan mode register 0 (ad0scm0) h'0080 0090 h'0080 0092 h'0080 0094 h'0080 0096 h'0080 0098 h'0080 009a h'0080 009c h'0080 009e h'0080 00a0 h'0080 00a2 h'0080 00a4 h'0080 00a6 h'0080 00a8 h'0080 00aa h'0080 00ac h'0080 00ae a-d0 successive approximation register (ad0sar) a-d0 comparate data register (ad0cmp) note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. a-d0 single mode register 1 (ad0sim1) a-d0 scan mode register 1 (ad0scm1) 10-bit a-d0 data register 1 (ad0dt1) 10-bit a-d0 data register 2 (ad0dt2) 10-bit a-d0 data register 3 (ad0dt3) 10-bit a-d0 data register 4 (ad0dt4) 10-bit a-d0 data register 5 (ad0dt5) 10-bit a-d0 data register 6 (ad0dt6) 10-bit a-d0 data register 7 (ad0dt7) 10-bit a-d0 data register 8 (ad0dt8) 10-bit a-d0 data register 9 (ad0dt9) 10-bit a-d0 data register 10 (ad0dt10) 10-bit a-d0 data register 11 (ad0dt11) 10-bit a-d0 data register 12 (ad0dt12) 10-bit a-d0 data register 13 (ad0dt13) 10-bit a-d0 data register 14 (ad0dt14) 10-bit a-d0 data register 15 (ad0dt15)
11 11-16 ver.0.10 figure 11.2.2 a-d converter related register map (2/4) a-d converters 11.2 a-d converter related registers h'0080 00d2 h'0080 00d4 h'0080 00d6 h'0080 00d8 h'0080 00da h'0080 00d0 address d0 d7 +0 address +1 address d8 d15 h'0080 00dc h'0080 00de h'0080 00e0 h'0080 00e2 h'0080 00e4 h'0080 00e6 h'0080 00e8 h'0080 00ea h'0080 00ec h'0080 00ee 8-bit a-d0 data register 15 (ad08dt15) blank addresses are reserved. 8-bit a-d0 data register 14 (ad08dt14) 8-bit a-d0 data register 13 (ad08dt13) 8-bit a-d0 data register 12 (ad08dt12) 8-bit a-d0 data register 11 (ad08dt11) 8-bit a-d0 data register 10 (ad08dt10) 8-bit a-d0 data register 9 (ad08dt9) 8-bit a-d0 data register 8 (ad08dt8) 8-bit a-d0 data register 7 (ad08dt7) 8-bit a-d0 data register 6 (ad08dt6) 8-bit a-d0 data register 5 (ad08dt5) 8-bit a-d0 data register 4 (ad08dt4) 8-bit a-d0 data register 3 (ad08dt3) 8-bit a-d0 data register 2 (ad08dt2) 8-bit a-d0 data register 1 (ad08dt1) 8-bit a-d0 data register 0 (ad08dt0)
11 11-17 ver.0.10 figure 11.2.3 a-d converter related register map (3/4) a-d converters 11.2 a-d converter related registers h'0080 0a84 h'0080 0a86 h'0080 0a88 h'0080 0a8a h'0080 0a8c h'0080 0a80 h'0080 0a82 d0 d7 d8 d15 h'0080 0a90 h'0080 0a92 h'0080 0a94 h'0080 0a96 h'0080 0a98 h'0080 0a9a h'0080 0a9c h'0080 0a9e h'0080 0aa0 h'0080 0aa2 h'0080 0aa4 h'0080 0aa6 h'0080 0aa8 h'0080 0aaa h'0080 0aac h'0080 0aae a-d1 single mode register 0 (ad1sim0) address +0 address +1 address 10-bit a-d1 data register 0 (ad1dt0) a-d1 scan mode register 0 (ad1scm0) a-d1 successive approximation register (ad1sar) a-d1 comparate data register (ad1cmp) note: the registers enclosed in thick frames must always be accessed in halfwords. blank addresses are reserved. a-d1 single mode register 1 (ad1sim1) a-d1 scan mode register 1 (ad1scm1) 10-bit a-d1 data register 1 (ad1dt1) 10-bit a-d1 data register 2 (ad1dt2) 10-bit a-d1 data register 3 (ad1dt3) 10-bit a-d1 data register 4 (ad1dt4) 10-bit a-d1 data register 5 (ad1dt5) 10-bit a-d1 data register 6 (ad1dt6) 10-bit a-d1 data register 7 (ad1dt7) 10-bit a-d1 data register 8 (ad1dt8) 10-bit a-d1 data register 9 (ad1dt9) 10-bit a-d1 data register 10 (ad1dt10) 10-bit a-d1 data register 11 (ad1dt11) 10-bit a-d1 data register 12 (ad1dt12) 10-bit a-d1 data register 13 (ad1dt13) 10-bit a-d1 data register 14 (ad1dt14) 10-bit a-d1 data register 15 (ad1dt15)
11 11-18 ver.0.10 figure 11.2.4 a-d converter related register map (4/4) a-d converters 11.2 a-d converter related registers h'0080 0ad2 h'0080 0ad4 h'0080 0ad6 h'0080 0ad8 h'0080 0ada h'0080 0ad0 d0 d7 d8 d15 h'0080 0adc h'0080 0ade h'0080 0ae0 h'0080 0ae2 h'0080 0ae4 h'0080 0ae6 h'0080 0ae8 h'0080 0aea h'0080 0aec h'0080 0aee address +0 address +1 address 8-bit a-d1 data register 15 (ad18dt15) blank addresses are reserved. 8-bit a-d1 data register 14 (ad18dt14) 8-bit a-d1 data register 13 (ad18dt13) 8-bit a-d1 data register 12 (ad18dt12) 8-bit a-d1 data register 11 (ad18dt11) 8-bit a-d1 data register 10 (ad18dt10) 8-bit a-d1 data register 9 (ad18dt9) 8-bit a-d1 data register 8 (ad18dt8) 8-bit a-d1 data register 7 (ad18dt7) 8-bit a-d1 data register 6 (ad18dt6) 8-bit a-d1 data register 5 (ad18dt5) 8-bit a-d1 data register 4 (ad18dt4) 8-bit a-d1 data register 3 (ad18dt3) 8-bit a-d1 data register 2 (ad18dt2) 8-bit a-d1 data register 1 (ad18dt1) 8-bit a-d1 data register 0 (ad18dt0)
11 11-19 ver.0.10 11.2.1 a-d single mode register 0 a-d0 single mode register 0 (ad0sim0) d bit name function r w 0,1 no functions assigned 0 2 ad0strg __________ 0: adtrg signal input (a-d0 hardware trigger selection) 1: output event bus 3 3 ad0ssel 0: software trigger (a-d0 conversion start trigger selection) 1: hardware trigger 4 ad0sreq 0: a-d0 interrupt request (interrupt request/dma transfer request selection) 1: dma transfer request 5 ad0scmp 0: a-d0 conversion/comparate in progress (a-d0 conversion/comparate completed) 1: a-d0 conversion/comparate completed 6 ad0sstp 0: performs no operation 0 (a-d0 conversion stop) 1: stops a-d0 conversion 7 ad0sstt 0: performs no operation 0 (a-d0 conversion start) 1: starts a-d0 conversion a-d0 single mode register 0 is used to control operation of the a-d0 converter during single mode (including special mode "forcible single mode execution during scan mode"). d0123456d7 ad0strg ad0ssel ad0sreq ad0scmp ad0sstp ad0sstt a-d converters 11.2 a-d converter related registers
11 11-20 ver.0.10 a-d1 single mode register 0 (ad1sim0) a-d1 single mode register 0 is used to control operation of the a-d1 converter during single mode (including special mode "forcible single mode execution during scan mode"). d bit name function r w 0,1 no functions assigned 0 2 ad1strg __________ 0: adtrg signal input (a-d1 hardware trigger selection) 1: tid1 overflow/underflow 3 ad1ssel 0: software trigger (a-d1 conversion start trigger selection) 1: hardware trigger 4 ad1sreq 0: enables a-d1 interrupt request (interrupt request) 1: disables a-d1 interrupt request 5 ad1scmp 0: a-d1 conversion/comparate in progress (a-d1 conversion/comparate completed) 1: a-d1 conversion/comparate completed 6 ad1sstp 0: performs no operation 0 (a-d1 conversion stop) 1: stops a-d1 conversion 7 ad1sstt 0: performs no operation 0 (a-d1 conversion start) 1: starts a-d1 conversion d0123456d7 ad1strg ad1ssel ad1sreq ad1scmp ad1sstp ad1sstt a-d converters 11.2 a-d converter related registers
11 11-21 ver.0.10 (1) adnstrg (a-dn hardware trigger selection) bit (d2) when starting a-d conversion of the a-dn converter in hardware, this bit selects whether to use external adtrg signal input or mjt output (output event bus 3 for a-d0, or tid1 overflow/ underflow for a-d1) to start the operation. the content of this bit is ignored when the adnssel (a-dn conversion start trigger selection) bit is set to choose a software trigger. when using the ____________ ____________ adtrg pin for a start trigger, not that if a-d conversion is completed while the adtrg pin input is held low, new a-d conversion is not started. (2) adnssel (a-dn conversion start trigger selection) bit (d3) this bit selects whether to use a software or hardware trigger to start a-dn conversion during single mode. when you choose a software trigger, a-d conversion is started by setting the adnsstt (a-dn conversion start) bit to 1. when you choose a hardware trigger, a-d conversion is started for the cause of start selected by the adnstrg (hardware trigger selection) bit. (3) adnsreq (a-dn interrupt request/dma transfer request selection) bit (d4) for the a-d0 converter (ad0sim0), this bit selects whether to request an a-d0 conversion interrupt or dma transfer when single mode operation (a-d conversion or comparate) is completed. for the a-d1 converter (ad1sim0), this bit selects whether to enable or disable an a- d0 conversion interrupt when single mode operation (a-d conversion or comparate) is completed. (4) adnscmp (a-dn conversion/comparate completion) bit (d5) this is a read-only bit, which when reset is 1. this bit is 0 when the a-dn converter is performing single mode operation (a-d conversion or comparate) and set to 1 when the operation is completed. this bit also is set to 1 when a-d conversion or comparate operation is forcibly terminated by setting the adnsstt (a-dn conversion stop) bit to 1 during a-d conversion or comparate operation. (5) adnsstp (a-dn conversion stop) bit (d6) single mode operation (a-d conversion or comparate) of the a-dn converter can be halted by setting this bit to 1 while the operation is in progress. manipulation of this bit is ignored when single mode is idle or when scan mode operation is under way. operation is halted immediately by a write to this bit, and when you read the a-dn successive approximation register after being halted, the content you get is the value in the middle of conversion. (not transferred to the a-dn data register.) if the a-dn conversion start bit and a-dn conversion stop bit are set to 1 at the same time, the a- dn conversion stop bit has priority. if this bit is set to 1 while operating in single mode during special mode "forcible single mode execution during scan mode," only single mode conversion is halted and scan mode operation is restarted. a-d converters 11.2 a-d converter related registers
11 11-22 ver.0.10 (6) adnsstt (a-dn conversion start) bit (d7) when this bit is set to 1 while a software trigger has been selected by the adnssel (a-dn conversion start trigger selection) bit, the a-dn converter starts a-d conversion. if the a-dn conversion start bit and a-dn conversion stop bit are set to 1 at the same time, the a- dn conversion stop bit has priority. if this bit is set to 1 again during single mode conversion, special operation mode "forcible single mode execution during scan mode" is entered into, so that the channel being converted in scan mode is canceled and single mode conversion is performed. when the single mode conversion finishes, scan mode a-d conversion is restarted beginning with the canceled channel. a-d converters 11.2 a-d converter related registers
11 11-23 ver.0.10 11.2.2 a-d single mode register 1 a-d0 single mode register 1 (ad0sim1) w= : only writing a 0 is effective; when you write a 1, device operation cannot be guaranteed. a-d0 single mode register 0 is used to control operation of the a-d0 converter during single mode (including special mode "forcible single mode execution during scan mode"). d bit name function r w 8 ad0smsl 0: a-d0 conversion mode (a-d0 conversion mode selection) 1: comparator mode 9 ad0sspd 0: normal rate (a-d0 conversion rate selection) 1: double rate 10,11 no functions assigned 0 12-15 an0sel 0000: selects ad0in0 (analog input pin selection) 0001: selects ad0in1 0010: selects ad0in2 0011: selects ad0in3 0100: selects ad0in4 0101: selects ad0in5 0110: selects ad0in6 0111: selects ad0in7 1000: selects ad0in8 1001: selects ad0in9 1010: selects ad0in10 1011: selects ad0in11 1100: selects ad0in12 1101: selects ad0in13 1110: selects ad0in14 1111: selects ad0in15 d8 9 1011121314d15 ad0smsl ad0sspd an0sel a-d converters 11.2 a-d converter related registers
11 11-24 ver.0.10 a-d1 single mode register 1 (ad1sim1) w= : only writing a 0 is effective; when you write a 1, device operation cannot be guaranteed. a-d1 single mode register 0 is used to control operation of the a-d1 converter during single mode (including special mode "forcible single mode execution during scan mode"). d bit name function r w 8 ad1smsl 0: a-d1 conversion mode (a-d1 conversion mode selection) 1: comparator mode 9 ad1sspd 0: normal rate (a-d1 conversion rate selection) 1: double rate 10,11 no functions assigned 0 12-15 an1sel 0000: selects ad1in0 (analog input pin selection) 0001: selects ad1in1 0010: selects ad1in2 0011: selects ad1in3 0100: selects ad1in4 0101: selects ad1in5 0110: selects ad1in6 0111: selects ad1in7 1000: selects ad1in8 1001: selects ad1in9 1010: selects ad1in10 1011: selects ad1in11 1100: selects ad1in12 1101: selects ad1in13 1110: selects ad1in14 1111: selects ad1in15 d8 9 1011121314d15 ad1smsl ad1sspd an1sel a-d converters 11.2 a-d converter related registers
11 11-25 ver.0.10 (1) adnsmsl (a-dn conversion mode selection) bit (d8) this bit selects a-d conversion mode for the a-dn converter during single mode. setting this bit to 0 selects a-d conversion mode, and setting this bit to 1 selects comparator mode. (2) adnsspd (a-dn conversion rate selection) bit (d9) this bit selects an a-d conversion rate for the a-dn converter during single mode. setting this bit to 0 selects a normal speed, and setting this bit to 1 selects a x2 speed (two times normal speed). (3) anssel (analog input pin selection) bits (d12-d15) these bits select analog input pins for the a-dn converter during single mode. it is the channels selected by these bits that are operated on for a-d conversion or comparate operation. when you read these bits, they show the values written to them. a-d converters 11.2 a-d converter related registers
11 11-26 ver.0.10 11.2.3 a-d scan mode register 0 a-d0 scan mode register 0 (ad0scm0) a-d0 scan mode register 0 is used to control operation of the a-d0 converter during scan mode. d bit name function r w 0 no functions assigned 0 1 ad0cmsl 0: single-shot mode (a-d0 scan mode selection) 1: continuous mode 2 ad0ctrg _________ 0: adtrg signal input (a-d0 hardware trigger selection) 1: output event bus 3 3 ad0csel 0: software trigger (a-d0 conversion start trigger selection) 1: hardware trigger 4 ad0creq 0: requests a-d0 interrupt (interrupt request/dma request selection) 1: requests dma transfer 5 ad0ccmp 0: a-d0 conversion in progress (a-d0 conversion completed) 1: a-d0 conversion completed 6 ad0cstp 0: performs no operation 0 (a-d0 conversion stop) 1: stops a-d0 conversion 7 ad0cstt 0: performs no operation 0 (a-d0 conversion start) 1: starts a-d0 conversion d0123456d7 ad0cmsl ad0ctrg ad0csel ad0creq ad0ccmp ad0cstp ad0cstt a-d converters 11.2 a-d converter related registers
11 11-27 ver.0.10 a-d1 scan mode register 0 (ad1scm0) d bit name function r w 0 no functions assigned 0 1 ad1cmsl 0: single-shot mode (a-d1 scan mode selection) 1: continuous mode 2 ad1ctrg _________ 0: adtrg signal input (a-d1 hardware trigger selection) 1: tid1 overflow/underflow 3 ad1csel 0: software trigger (a-d1 conversion start trigger selection) 1: hardware trigger 4 ad1creq 0: enables a-d1 interrupt request (interrupt request selection) 1: disables a-d1 interrupt request 5 ad1ccmp 0: a-d1 conversion in progress (a-d1 conversion completed) 1: a-d1 conversion completed 6 ad1cstp 0: performs no operation 0 (a-d1 conversion stop) 1: stops a-d1 conversion 7 ad1cstt 0: performs no operation 0 (a-d1 conversion start) 1: starts a-d1 conversion a-d1 scan mode register 0 is used to control operation of the a-d1 converter during scan mode. d0123456d7 ad1cmsl ad1ctrg ad1csel ad1creq ad1ccmp ad1cstp ad1cstt a-d converters 11.2 a-d converter related registers
11 11-28 ver.0.10 (1) adncmsl (a-dn scan mode selection) bit (d1) this bit selects scan mode of the a-dn converter between single-shot scan and continuous scan. setting this bit to 0 selects single-shot scan mode, so that the channels selected by the annscan (scan loop selection) bits are sequentially a-d converted and when a-d conversion in all selected channels are completed, the conversion operation stops. setting this bit to 1 selects continuous scan mode, so that when operation in single-shot scan mode is completed, the selected channels are a-d converted beginning with the first channel again. this a-d conversion is continued until halted by setting the adncstp (a-dn conversion stop) bit to 1. (2) adnctrg (a-dn hardware trigger selection) bit (d2) when starting a-d conversion of the a-dn converter in hardware, this bit selects whether to use external adtrg signal input or mjt output (output event bus 3 for a-d0, or tid1 overflow/ underflow for a-d1) to start the operation. the content of this bit is ignored when the adnssel (a-dn conversion start trigger selection) bit is set to choose a software trigger. when using the ____________ ____________ adtrg pin for a start trigger, not that if a-d conversion is completed while the adtrg pin input is held low, new a-d conversion is not started. (3) adncsel (a-dn conversion start trigger selection) bit (d3) this bit selects whether to use a software or hardware trigger to start a-d conversion of the a-dn converter during scan mode. when you choose a software trigger, a-d conversion is started by setting the adncstt (a-dn conversion start) bit to 1. when you choose a hardware trigger, a-d conversion is started for the cause of start selected by the adnctrg (hardware trigger selection) bit. (4) adncreq (a-dn interrupt request/dma transfer request selection) bit (d4) for the a-d0 converter (ad0scm0), this bit selects whether to request an a-d0 conversion interrupt or dma transfer when one cycle of scan operation is completed. for the a-d1 converter (ad1scm0), this bit selects whether to enable or disable an a-d0 conversion interrupt when one cycle of scan operation is completed. (5) adnccmp (a-dn conversion completion) bit (d5) this is a read-only bit, which when reset is 1. this bit is 0 when the a-dn converter is performing scan mode a-d conversion and set to 1 when single-shot scan mode is completed, or when continuous scan mode is halted by setting adncstt (a-dn conversion stop) bit to 1. a-d converters 11.2 a-d converter related registers
11 11-29 ver.0.10 (6) adncstp (a-dn conversion stop) bit (d6) scan mode a-d conversion of the a-dn converter can be halted by setting this bit to 1 while the operation is in progress. this bit is effective only when operating in scan mode. if single mode and scan mode both are active in special operation mode, manipulation of this bit does not affect single mode operation. scan mode operation is halted immediately by a write to this bit, and the a-d conversion being executed in a channel is aborted in the middle, without transfer to the a-d data register. if the a-dn conversion start bit and a-dn conversion stop bit are set to 1 at the same time, the a- dn conversion stop bit has priority. (7) adncstt (a-dn conversion start) bit (d7) this bit is used to start scan mode operation of the a-dn converter in software. this bit is effective only when a software trigger has been selected by the adncsel (a-dn conversion start trigger selection) bit, and starts a-d conversion when it is set to 1. if the a-dn conversion start bit and a-dn conversion stop bit are set to 1 at the same time, the a- dn conversion stop bit has priority. if this bit is set to 1 again during scan mode conversion, special operation mode "conversion restart" is entered into, so that scan operation is restarted according to the contents set by scan mode register 0 and scan mode register 1. if this bit is set to 1 again during single mode a-d conversion, special operation mode "scan mode start after single mode execution" is entered into, so that scan mode operation is started subsequently after single mode is completed. a-d converters 11.2 a-d converter related registers
11 11-30 ver.0.10 11.2.4 a-d scan mode register 1 a-d0 scan mode register 1 (ad0scm1) a-d0 scan mode register 1 is used to control operation of the a-d0 converter during scan mode. d bit name function r w 8 no functions assigned 0 9 ad0cspd 0: normal (a-d0 conversion rate selection) 1: x2 10,11 no functions assigned 0 12-15 an0scan (a-d0 scan loop selection) 01xx: 4-channel scan 10xx: 8-channel scan 11xx: 16-channel scan 00xx: 16-channel scan 0000: converting ad0in0 0001: converting ad0in1 0010: converting ad0in2 0011: converting ad0in3 0100: converting ad0in4 0101: converting ad0in5 0110: converting ad0in6 0111: converting ad0in7 1000: converting ad0in8 1001: converting ad0in9 1010: converting ad0in10 1011: converting ad0in11 1100: converting ad0in12 1101: converting ad0in13 1110: converting ad0in14 1111: converting ad0in15 d8 9 1011121314d15 ad0cspd an0scan a-d converters 11.2 a-d converter related registers
11 11-31 ver.0.10 d8 9 1011121314d15 ad1cspd an1scan a-d1 scan mode register 1 (ad1scm1) d bit name function r w 8 no functions assigned 0 9 ad1cspd 0: normal (a-d1 conversion rate selection) 1: x2 10,11 no functions assigned 0 12-15 an1scan (a-d1 scan loop selection) 01xx: 4-channel scan 10xx: 8-channel scan 11xx: 16-channel scan 00xx: 16-channel scan 0000: converting ad1in0 0001: converting ad1in1 0010: converting ad1in2 0011: converting ad1in3 0100: converting ad1in4 0101: converting ad1in5 0110: converting ad1in6 0111: converting ad1in7 1000: converting ad1in8 1001: converting ad1in9 1010: converting ad1in10 1011: converting ad1in11 1100: converting ad1in12 1101: converting ad1in13 1110: converting ad1in14 1111: converting ad1in15 a-d1 scan mode register 1 is used to control operation of the a-d1 converter during scan mode. a-d converters 11.2 a-d converter related registers
11 11-32 ver.0.10 (1) adncspd (a-dn conversion rate selection) bit (d9) this bit selects an a-d conversion rate for the a-dn converter during scan mode. setting this bit to 0 selects a normal speed, and setting this bit to 1 selects a x2 speed (two times normal speed). (2) annscan (a-dn scan loop selection) bits (d12-d15) the annscan (a-dn scan loop selection) bits set the channels to be scanned during scan mode of the a-dn converter. in this case, writes to d14 and d15 have no effect. the annscan (a-dn scan loop selection) bits when read during scan operation show the status of the a-dn converter, indicating the channel it is converting. the value read from these bits during single mode are always "b'0000." if a-d conversion is halted by setting scan mode register 0 adncstp (a-dn conversion stop) bit to 1 during scan mode execution, the bits when read at this time show the value of the channel in which the a-d conversion has been canceled. also, if halted during single mode conversion in special operation mode "forcible single mode execution during scan mode," the bits when read at this time show the value of the channel in which the a-d conversion has been canceled in the middle of scan. a-d converters 11.2 a-d converter related registers
11 11-33 ver.0.10 11.2.5 a-d successive approximation register a-d0 successive approximation register (ad0sar) note: this register must always be accessed in halfwords. the a-d0 successive approximation register (ad0sar), when in a-d conversion mode, is used to read out the conversion result of the a-dn converter, and when in comparator mode, it is used to write a comparison value. in a-d conversion mode, the successive approximation method is used to perform a-d conversion. with this method, the reference voltage vref and analog input voltages are sequentially compared bitwise beginning with the high-order side, and the comparison result is set in the a-d0 successive approximation register (ad0sar) bits (d6-d15). after the a-d conversion is completed, the value of this register is transferred to the 10-bit a-d0 data register (ad0dtn) corresponding to the converted channel. when you read this register in the middle of a-d conversion, you see the result in the middle of conversion. in comparator mode, write a comparison value (the value to be compared in comparate operation) to this register. simultaneously with a write to this register, comparate operation with the analog input pin that has been set by single mode register 1 starts. after comparate operation, the result is stored in the a-d0 comparate data register (ad0cmp). use the calculation formula shown below to find the comparison value to be written to the a-d0 successive approximation register (ad0sar) during comparator mode. d bit name function r w 0-5 no functions assigned 0 6-15 ad0sar a-d successive approximation value (a-d0 successive approximation (a-d conversion mode) value/comparison value) comparison value (comparator mode) comparate comparison voltage [v] vref0 input voltage [v] comparison value = h'3ff d01234567891011121314d15 ad0sar a-d converters 11.2 a-d converter related registers
11 11-34 ver.0.10 a-d1 successive approximation register (ad1sar) note: this register must always be accessed in halfwords. the a-d1 successive approximation register (ad1sar), when in a-d conversion mode, is used to read out the conversion result of the a-d1 converter, and when in comparator mode, it is used to write a comparison value. in a-d conversion mode, the successive approximation method is used to perform a-d conversion. with this method, the reference voltage vref and analog input voltages are sequentially compared bitwise beginning with the high-order side, and the comparison result is set in the a- d1successive approximation register (ad1sar) bits (d6-d15). after the a-d conversion is completed, the value of this register is transferred to the 10-bit a-d1 data register (ad1dtn) corresponding to the converted channel. when you read this register in the middle of a-d conversion, you see the result in the middle of conversion. in comparator mode, write a comparison value (the value to be compared in comparate operation) to this register. simultaneously with a write to this register, comparate operation with the analog input pin that has been set by single mode register 1 starts. after comparate operation, the result is stored in the a-d1 comparate data register (ad1cmp). use the calculation formula shown below to find the comparison value to be written to the a- d1successive approximation register (ad1sar) during comparator mode. d bit name function r w 0-5 no functions assigned 0 6-15 ad1sar a-d successive approximation value (a-d1 successive approximation (a-d conversion mode) value/comparison value) comparison value (comparator mode) comparate comparison voltage [v] vref1 input voltage [v] comparison value = h'3ff d01234567891011121314d15 ad1sar a-d converters 11.2 a-d converter related registers
11 11-35 ver.0.10 11.2.6 a-d0 comparate data register a-d0 comparate data register (ad0cmp) a-d converters 11.2 a-d converter related registers note 1: this register must always be accessed in halfwords. note 2: during comparator mode, each bit corresponds to channels 0 through 15. when comparator mode is selected by setting the a-d0 single mode register 1 ad0smsl (a-d0 conversion mode selection) bit, the selected analog input value is compared with the value written to the a-d0 successive approximation register, with the result stored in the corresponding bit of this comparate data register. the bit is 0 when the analog input voltage > comparison voltage, and is 1 when the analog input voltage < comparison voltage. d bit name function r w 0-15 ad0cmp0-ad0cmp15 (note 2) 0: analog input voltage > comparison voltage (a-d0 comparate result flag) 1: analog input voltage < comparison voltage d01234567891011121314d15 ad0 cmp12 ad0 cmp11 ad0 cmp9 ad0 cmp8 ad0 cmp7 ad0 cmp5 ad0 cmp4 ad0 cmp3 ad0 cmp2 ad0 cmp1 ad0 cmp0 ad0 cmp15 ad0 cmp14 ad0 cmp13 ad0 cmp10 ad0 cmp6
11 11-36 ver.0.10 a-d1 comparate data register (ad1cmp) note 1: this register must always be accessed in halfwords. note 2: during comparator mode, each bit corresponds to channels 0 through 15. when comparator mode is selected by setting the a-d1 single mode register 1 ad1smsl (a-d1 conversion mode selection) bit, the selected analog input value is compared with the value written to the a-d0 successive approximation register, with the result stored in the corresponding bit of this comparate data register. the bit is 0 when the analog input voltage > comparison voltage, and is 1 when the analog input voltage < comparison voltage. d01234567891011121314d15 ad1 cmp12 ad1 cmp11 ad1 cmp9 ad1 cmp8 ad1 cmp7 ad1 cmp5 ad1 cmp4 ad1 cmp3 ad1 cmp2 ad1 cmp1 ad1 cmp0 ad1 cmp15 ad1 cmp14 ad1 cmp13 ad1 cmp10 ad1 cmp6 d bit name function r w 0-15 ad1cmp0-ad1cmp15 (note 2) 0: analog input voltage > comparison voltage (a-d1 comparate result flag) 1: analog input voltage < comparison voltage a-d converters 11.2 a-d converter related registers
11 11-37 ver.0.10 11.2.7 10-bit a-d data registers 10-bit a-d0 data register 0 (ad0dt0) 10-bit a-d0 data register 1 (ad0dt1) 10-bit a-d0 data register 2 (ad0dt2) 10-bit a-d0 data register 3 (ad0dt3) 10-bit a-d0 data register 4 (ad0dt4) 10-bit a-d0 data register 5 (ad0dt5) 10-bit a-d0 data register 6 (ad0dt6) 10-bit a-d0 data register 7 (ad0dt7) 10-bit a-d0 data register 8 (ad0dt8) 10-bit a-d0 data register 9 (ad0dt9) 10-bit a-d0 data register 10 (ad0dt10) 10-bit a-d0 data register 11 (ad0dt11) 10-bit a-d0 data register 12 (ad0dt12) 10-bit a-d0 data register 13 (ad0dt13) 10-bit a-d0 data register 14 (ad0dt14) 10-bit a-d0 data register 15 (ad0dt15) note: this register must always be accessed in halfwords. in single mode of the a-d0 converter, the result of a-d conversion is stored in the 10-bit a-d0 data register for each corresponding channel. in single-shot and continuous scan modes, the content of the a-d0 successive approximation register is transferred to the 10-bit a-d data register for the corresponding channel every time the a-d conversion in each channel is completed. each 10-bit a- d data register retains the last conversion result until they receive the next conversion result transferred, allowing the content to be read out at any time. d bit name function r w 0-5 no functions assigned 0 6-15 ad0dt0-ad0dt15 a-d conversion result (a-d0 data) d01234567891011121314d15 ad0dt0-ad0dt15 a-d converters 11.2 a-d converter related registers
11 11-38 ver.0.10 10-bit a-d1 data register 0 (ad1dt0) 10-bit a-d1 data register 1 (ad1dt1) 10-bit a-d1 data register 2 (ad1dt2) 10-bit a-d1 data register 3 (ad1dt3) 10-bit a-d1 data register 4 (ad1dt4) 10-bit a-d1 data register 5 (ad1dt5) 10-bit a-d1 data register 6 (ad1dt6) 10-bit a-d1 data register 7 (ad1dt7) 10-bit a-d1 data register 8 (ad1dt8) 10-bit a-d1 data register 9 (ad1dt9) 10-bit a-d1 data register 10 (ad1dt10) 10-bit a-d1 data register 11 (ad1dt11) 10-bit a-d1 data register 12 (ad1dt12) 10-bit a-d1 data register 13 (ad1dt13) 10-bit a-d1 data register 14 (ad1dt14) 10-bit a-d1 data register 15 (ad1dt15) note: this register must always be accessed in halfwords. in single mode of the a-d1 converter, the result of a-d conversion is stored in the 10-bit a-d1 data register for each corresponding channel. in single-shot and continuous scan modes, the content of the a-d1 successive approximation register is transferred to the 10-bit a-d data register for the corresponding channel every time the a-d conversion in each channel is completed. each 10-bit a- d data register retains the last conversion result until they receive the next conversion result transferred, allowing the content to be read out at any time. d bit name function r w 0-5 no functions assigned 0 6-15 ad1dt0-ad1dt15 a-d conversion result (a-d1 data) d01234567891011121314d15 ad1dt0-ad1dt15 a-d converters 11.2 a-d converter related registers
11 11-39 ver.0.10 11.2.8 8-bit a-d data registers 8-bit a-d0 data register 0 (ad08dt0) 8-bit a-d0 data register 1 (ad08dt1) 8-bit a-d0 data register 2 (ad08dt2) 8-bit a-d0 data register 3 (ad08dt3) 8-bit a-d0 data register 4 (ad08dt4) 8-bit a-d0 data register 5 (ad08dt5) 8-bit a-d0 data register 6 (ad08dt6) 8-bit a-d0 data register 7 (ad08dt7) 8-bit a-d0 data register 8 (ad08dt8) 8-bit a-d0 data register 9 (ad08dt9) 8-bit a-d0 data register 10 (ad08dt10) 8-bit a-d0 data register 11 (ad08dt11) 8-bit a-d0 data register 12 (ad08dt12) 8-bit a-d0 data register 13 (ad08dt13) 8-bit a-d0 data register 14 (ad08dt14) 8-bit a-d0 data register 15 (ad08dt15) this a-d data register stores the 8-bit conversion data from the a-d0 converter. in single mode of the a-d0 converter, the result of a-d conversion is stored in the 8-bit a-d0 data register for each corresponding channel. in single-shot and continuous scan modes, the content of the a-d0 successive approximation register is transferred to the 8-bit a-d data register for the corresponding channel every time the a-d conversion in each channel is completed. each 8-bit a- d data register retains the last conversion result until they receive the next conversion result transferred, allowing the content to be read out at any time. d bit name function r w 8-15 ad08dt0-ad08dt15 8-bit a-d conversion result (8-bit a-d0 data) d8 9 1011121314d15 ad08dt0-ad08dt15 a-d converters 11.2 a-d converter related registers
11 11-40 ver.0.10 8-bit a-d1 data register 0 (ad18dt0) 8-bit a-d1 data register 1 (ad18dt1) 8-bit a-d1 data register 2 (ad18dt2) 8-bit a-d1 data register 3 (ad18dt3) 8-bit a-d1 data register 4 (ad18dt4) 8-bit a-d1 data register 5 (ad18dt5) 8-bit a-d1 data register 6 (ad18dt6) 8-bit a-d1 data register 7 (ad18dt7) 8-bit a-d1 data register 8 (ad18dt8) 8-bit a-d1 data register 9 (ad18dt9) 8-bit a-d1 data register 10 (ad18dt10) 8-bit a-d1 data register 11 (ad18dt11) 8-bit a-d1 data register 12 (ad18dt12) 8-bit a-d1 data register 13 (ad18dt13) 8-bit a-d1 data register 14 (ad18dt14) 8-bit a-d1 data register 15 (ad18dt15) this a-d data register stores the 8-bit conversion data from the a-d1 converter. in single mode of the a-d1 converter, the result of a-d conversion is stored in the 8-bit a-d1 data register for each corresponding channel. in single-shot and continuous scan modes, the content of the a-d1 successive approximation register is transferred to the 8-bit a-d data register for the corresponding channel every time the a-d conversion in each channel is completed. each 8-bit a- d data register retains the last conversion result until they receive the next conversion result transferred, allowing the content to be read out at any time. d bit name function r w 8-15 ad18dt0-ad18dt15 8-bit a-d1 conversion result (8-bit a-d1 data) d8 9 1011121314d15 ad18dt0-ad18dt15 a-d converters 11.2 a-d converter related registers
11 11-41 ver.0.10 11.3 functional description of a-d converters 11.3.1 how to find along input voltages the a-d converters use a 10-bit successive approximation method, and find the actual analog input voltage from the value (digital quantity) obtained through execution of a-d conversion by performing the following calculation. the a-d converters are a 10-bit converter, providing a resolution of 1,024 discrete voltage levels. because the reference voltage for the a-d converter is the voltage applied to the vref pin, make sure an exact and stable constant-voltage power supply is connected to vref. also, make sure the analog circuit power supply and ground (avcc, avss) are separated from those of the digital circuit, with sufficient noise prevention measures incorporated. for details about the conversion accuracy, refer to section 11.3.5, "accuracy of a-d conversion." analog input voltage [v] = figure 11.3.1 outline block diagram of the successive approximation-type a-d converter unit a-d conversion result x vref input voltage [v] 1024 a-d converters 11.3 functional description of a-d converters adiin0 adiin1 adiin2 adiin3 adiin4 adiin5 adiin6 adiin7 selector avssi vrefi 10-bit a-di successive approximation register (adisar) 10-bit a-di data register a-di comparate data register a-d control circuit 10-bit a-d converter comparator adiin8 adiin9 adiin10 adiin11 adiin12 adiin13 adiin14 adiin15 adicmp adidt0-15 successive approximation-type a-d converter unit avcci vref vin i=0, 1
11 11-42 ver.0.10 11.3.2 a-d conversion by successive approximation method the a-d converter has a-d convert operation started by an a-d conversion start trigger (in software or hardware). once a-d conversion begins, the following operation is automatically executed. ? during single mode, single mode register 0's a-d conversion/comparate completion bit is cleared to 0. during scan mode, can mode register 0's a-d conversion completion bit is cleared to 0. ? the content of the a-d successive approximation register is cleared to "h'0000." ? the a-d successive approximation register's most significant bit (d6) is set to 1. ? the comparison voltage, vref(note), is fed from the d-a converter into the comparator. ? the comparison voltage, vref, and the analog input voltage, vin, are compared, with the comparison result stored in d6. if vref < vin, then d6 = 1 if vref > vin, then d6 = 0 ? operations in steps ? through ? above are executed for all other bits from d7 to d15. ? the value stored in the a-d successive approximation register at completion of the comparison of d15 is the final a-d conversion result. figure 11.3.2 changes of the a-d successive approximation register during a-d convert operation note: the comparison voltage, vref (the voltage fed from the d-a converter into the comparator), is determined according to changes of the content of the a-d successive approximation register. shown below are the equations used to calculate the comparison voltage, vref. when the content of the a-d successive approximation register = 0 vref [v] = 0 when the content of the a-d successive approximation register = 1 to 1,023 vref [v] = (reference voltage vref / 1,024) x (content of the a-d successive approximation register - 0.5) a-d converters 11.3 functional description of a-d converters 1st comparison d6 7 8 9 10 11 12 13 14 d15 100000 0000 n910000 0000 n9n81000 0000 n9 n8 n7 n6 n5 n4 n3 n2 n1 1 2nd comparison 3rd comparison 10th comparison conversion completed n9 n8 n7 n6 n5 n4 n3 n2 n1 n0 result of 1st comparison result of 2nd comparison vref > vin then nx=0 vref < vin then nx=1 a-d successive approximation register (adisar) i=0,1
11 11-43 ver.0.10 the comparison result finally is stored in the 10-bit a-d data register (ad0dtn, ad1dtn) corresponding to each converted channel. also, the 8-bit a-d data register (ad08dtn, ad18dtn) contains the 8 high-order bits of the 10-bit a-d conversion result. the following shows the procedure for a-d conversion by successive approximation in each operation mode. (1) single mode the convert operation stops when comparison of the a-d successive approximation register's d15 bit is completed. the content (a-d conversion result) of the a-d successive approximation register is transferred to the 10-bit a-d data registers 0-15 for the converted channel. (2) single-shot scan mode when comparison of the a-d successive approximation register's d15 bit in a specified channel is completed, the content of the a-d successive approximation register is transferred to the corresponding 10-bit a-d data registers 0-15, and convert operations in steps (2) to (7) above are reexecuted for the next channel to be converted. in single-shot scan mode, the convert operation stops when a-d conversion for one specified scan loop is completed. (3) continuous scan mode when comparison of the a-d successive approximation register's d15 bit in a specified channel is completed, the content of the a-d successive approximation register is transferred to the corresponding 10-bit a-d data registers 0-15, and convert operations in steps (2) to (7) above are reexecuted for the next channel to be converted. during continuous scan mode, the convert operation is executed continuously until scan operation is forcibly halted by setting the a-d conversion stop bit (scan mode register 0's d6 bit) to 1. a-d converters 11.3 functional description of a-d converters
11 11-44 ver.0.10 11.3.3 comparator operation when comparator mode (single mode only) is selected, the a-d converter functions as a comparator that compares analog input voltages with a preset comparison voltage. when a comparison value is written to the successive approximation register, the a-d converter starts 'comparating' the analog input voltage selected by the single mode register 1 analog input selection bit with the value written to the successive approximation register. once comparate begins, the following operation is automatically executed. ? the single mode register 0 or scan mode register 0's a-d conversion/comparate completion flag is cleared to 0. ? the comparison voltage, vref(note), is fed from the d-a converter into the comparator. ? the comparison voltage, vref, and the analog input voltage, vin, are compared, with the comparison result stored in the comparate result flag (a-d comparate data register's d15). if vref < vin, then the comparate result flag = 0 if vref > vin, then the comparate result flag = 1 ? the comparate operation stops after storing the comparison result. the comparison result is stored in the a-d comparate data register (ad0cmp, ad1cmp)'s corresponding bit. note: the comparison voltage, vref (the voltage fed from the d-a converter into the comparator), is determined according to changes of the content of the a-d successive approximation register. shown below are the equations used to calculate the comparison voltage, vref. when the content of the a-d successive approximation register = 0 vref [v] = 0 when the content of the a-d successive approximation register = 1 to 1,023 vref [v] = (reference voltage vref / 1,024) x (content of the a-d successive approximation register - 0.5) a-d converters 11.3 functional description of a-d converters
11 11-45 ver.0.10 11.3.4 calculation of the a-d conversion time the a-d conversion time is expressed by the sum of dummy cycle time and the actual execution cycle time. the following shows each time factor necessary to calculate the conversion time. ? start dummy time a time from when the cpu executed the a-d conversion start instruction to when the a-d converter starts a-d conversion ? a-d conversion execution cycle time ? comparate execution cycle time ? end dummy time a time from when the a-d converter finished a-d conversion to when the cpu can stably read out this conversion result from the a-d data register ? scan to scan dummy time a time during single-shot or continuous scan mode from when the a-d converter finished a-d conversion in a channel to when it starts a-d conversion in the next channel the equation to calculate the a-d conversion time is as follows: a-d conversion time = start dummy time + execution cycle time (+ scan to scan dummy time + execution cycle time + scan to scan dummy time + execution cycle time + scan to scan dummy time .... + execution cycle time) + end dummy time note: shown in ( ) are the conversion time required for the second and subsequent channels to be converted in scan mode. a-d converters 11.3 functional description of a-d converters
11 11-46 ver.0.10 figure 11.3.3 conceptual diagram of a-d conversion time table 11.3.1 list of conversion clock periods unit: bclk transfer start dummy a-d conversion comparate execu- end scan to scan rate (note 1) (note 2) (note 3) execution cycle tion cycle dummy dummy (note 4) normal rate 4 4 4 294 42 1 4 double rate 4 4 4 168 24 1 4 note 1: this applies to a software triggered case. note 2: this applies to a hardware triggered case. note 3: this applies to a comparator mode case where a value is written to the a-d successive approximation register. note 4: this applies to only scan mode, and is added to the execution time for each channel. a-d converters 11.3 functional description of a-d converters start dummy execution cycle a-d conversion start trigger convert operation begins transferred to a-d data register end dummy start dummy execution cycle execution cycle completed execution cycle end dummy . . . . . scan to scan dummy scan to scan dummy (channel 0) (channel 1) (last channel)
11 11-47 ver.0.10 table 11.3.2 total a-d conversion time conversion started by conversion rate conversion mode (note 1) conversion time [bclk] software trigger normal single mode 299 (note 2) single-shot scan 4-channel scan 1193 /continuous 8-channel scan 2385 16-channel scan 4769 comparator mode 47 2 single mode 173 single-shot scan 4-channel scan 689 /continuous 8-channel scan 1377 16-channel scan 2753 comparator mode 27 hardware trigger normal single mode 299 (note 3) single-shot scan 4-channel scan 1193 /continuous 8-channel scan 2385 16-channel scan 4769 comparator mode 47 2 single mode 173 single-shot scan 4-channel scan 689 /continuous 8-channel scan 1377 16-channel scan 2753 comparator mode 27 note 1 : for single and comparator modes, this shows the time for a-d conversion in one channel or for comparate operation. for single-shot and continuous scan modes, this shows the time for a-d conversion in one scan loop. note 2 : this shows the time from when a write-to-register cycle is completed to when an a-d conversion interrupt request is generated. note 3 : _________ this shows the time from when the adtrg pin input is asserted low or output event bus 3 is actuated _________ (for the a-d0 converter) or from when the adtrg pin input is asserted low or tid1 overflow/underflow occurs (for the a-d1 converter) to when an a-d conversion interrupt request is generated. a-d converters 11.3 functional description of a-d converters
11 11-48 ver.0.10 11.3.5 definition of the a-d conversion accuracy the following defines the a-d conversion accuracy. (1) resolution ............... number of digital converted codes output by the a-d converter (2) nonlinearity error .... deviation from i deal conversion characteristics after the offset and full- scale errors are adjusted to 0. (figure 11.3.5) (3) offset error .............. refers to an amount of dislocation by which the actual digital output code is dislocated from the digital output code obtained from the a-d converter's ideal conversion line. (figure 11.3.6) (4) full-scale error ........ refers to an amount of dislocation by which the analog input voltage at which the digital output code reached the full-scale value is dislocated from the nominal value. (figure 11.3.7) figure 11.3.4 ideal a-d conversion characteristics relative to the 10-bit a-d converter's analog input voltages a-d converters 11.3 functional description of a-d converters h'000 h'001 h'002 h'003 h'3fe h'3ff a-d conversion result (hex) analog input voltage [v] vref 1024 x1 ideal a-d conversion characteristic a-d conversion characteristic with infinite resolution 0 vref 1024 x2 vref 1024 x3 vref 1024 x1022 vref 1024 x1023 vref 1024 x1024
11 11-49 ver.0.10 nonlinearity error actual a-d conversion characteristic that contains nonlinearity error a-d conversion result along input level full scale full scale ideal conversion line figure 11.3.5 a-d converter's nonlinearity error figure 11.3.6 a-d converter's offset error a-d converters 11.3 functional description of a-d converters conversion line offset to the negative side conversion line offset to the positive side offset error a-d conversion result along input level full scale full scale ideal conversion line
11 11-50 ver.0.10 figure 11.3.7 a-d converter's full-scale error a-d converters 11.3 functional description of a-d converters conversion line where the output code reaches the full scale for analog inputs lower than the fullscale full-scale error conversion line where the output code does not reach the full scale even for full-scale equivalent analog inputs a-d conversion result along input level full scale full scale ideal conversion line
11 11-51 ver.0.10 11.4 precautions on using a-d converters ?forcible termination during scan operation if a-d conversion is halted by setting the a-d conversion stop bit (ad0cstp, ad1cstp) to 1 during scan mode operation and you read the content of the a-d data register for the channel in which conversion was in progress, it shows the last conversion result that had been transferred to the a-d data register before the conversion was forcibly terminated. ____________ ?adtrg signal and input/output port ____________ if you selected the adtrg signal for an a-d conversion start trigger, do not use the adtrg pin as an input/output port (p67). ?modification of a-d converter related registers if you want to change the contents of the a-d conversion interrupt control register, each single and scan mode register, or a-d successive approximation register, except for the a-d conversion stop bit, do your change while a-d conversion is inactive, or be sure to restart a-d conversion after you changed the register contents. if the contents of these registers are changed in the middle of a-d conversion, the conversion results cannot be guaranteed. ?handling of analog input signals the a-d converters included in the 32170 do not have a sample-and-hold circuit. therefore, make sure the analog input levels are fixed during a-d conversion. ?a-d conversion completion bit readout timing if you want to read the a-d conversion completion bit (single mode register 0's d5 bit or scan mode register 0's d5 bit) immediately after a-d conversion has started, be sure to adjust the timing one clock cycle by, for example, inserting a nop instruction before you read. a-d converters 11.4 precautions on using a-d converters
11 11-52 ver.0.10 a-d converters 11.4 precautions on using a-d converters * this is a blank page. *
chapter 12 serial i/o 12.1 outline of serial i/o 12.2 serial i/o related registers 12.3 transmit operation in csio mode 12.4 receive operation in csio mode 12.5 precautions on using csio mode 12.6 transmit operation in uart mode 12.7 receive operation in uart mode 12.8 fixed period clock output function 12.9 precautions on using uart mode
12 12-2 ver.0.10 12.1 outline of serial i/o the 32170 contains a total of six channels of serial i/o-sio0, sio1, sio2, sio3, sio4, and sio5. sio0, sio1, sio4, and sio5 can be selected between csio mode (clock-synchronous serial i/o) and uart mode (asynchronous serial i/o). sio2 and sio3 are uart mode only. ? csio mode (clock-synchronous serial i/o) communication is performed synchronously with transfer clock, using the same clock on both transmit and receive sides. the transfer data is 8 bits long (fixed). ? uart mode (asynchronous serial i/o) communication is performed asynchronously. the transfer data length can be selected from 7 bits, 8 bits, and 9 bits. serial i/o0-3 each have a transmit dma transfer and a receive dma transfer request. these transfer requests, when combined with the internal dmac, allow serial communication to be performed at high speed, as well as reduce the cpu burdens imposed by data communication. serial i/o is outlined in the pages to follow. serial i/o 12.1 outline of serial i/o
12 12-3 ver.0.10 serial i/o 12.1 outline of serial i/o table 12.1.1 outline of serial i/o item content number of channels csio/uart : 4 channels (sio0, sio1, sio4, sio5) uart only : 2 channels (sio2, sio3) clock during csio mode : internal clock or external clock as selected (note 1) during uart mode : internal clock only transfer mode transmit half-duplex, receive half-duplex, transmit/receive full-duplex brg count source f(bclk), f(bclk)/8, f(bclk)/32, f(bclk)/256 (when internal peripheral clock selected) (note 2) f(bclk) : internal peripheral clock operating frequency data format csio mode : data length = 8 bits (fixed) order of transfer = lsb first (fixed) uart mode : start bit = 1 bit character length = 7, 8, or 9 bits parity bit = added or not added (when added, selectable between odd and even parity) stop bit = 1 or 2 bits order of transfer = lsb first (fixed) baud rate csio mode : 152 bits/sec to 2m bits/sec (at f(bclk) = 20 mhz) uart mode : 19 bits/sec to 156k bits/sec (at f(bclk) = 20 mhz) error detection csio mode : overrun error only uart mode : overrun error, parity error, framing error (occurrence of any of these errors is indicated by an error sum bit) fixed period clock function when using sio0, sio1, sio4 and sio5 as uart, this function outputs a divided- by-2 brg clock from the sclk pin. note 1 : the maximum input frequency of external clock during csio mode is 1/16 of f(bclk). note 2 : when f(bclk) is selected as the brg count source, the brg set value is subject to limitations.
12 12-4 ver.0.10 table 12.1.2 serial i/o interrupt request generation function serial i/o interrupt request icu interrupt cause sio0 transmit buffer empty interrupt sio0 transmit interrupt sio0 receive-finished sio0 receive interrupt or receive error interrupt (selectable) sio1 transmit buffer empty interrupt sio1 transmit interrupt sio1 receive-finished sio1 receive interrupt or receive error interrupt (selectable) sio2 transmit buffer empty interrupt sio2, 3 transmit/receive interrupt (group interrupt) sio2 receive-finished sio2, 3 transmit/receive interrupt (group interrupt) or receive error interrupt (selectable) sio3 transmit buffer empty interrupt sio2, 3 transmit/receive interrupt (group interrupt) sio3 receive-finished sio2, 3 transmit/receive interrupt (group interrupt) or receive error interrupt (selectable) sio4 transmit buffer empty interrupt sio4, 5 transmit/receive interrupt (group interrupt) sio4 receive-finished sio4, 5 transmit/receive interrupt (group interrupt) or receive error interrupt (selectable) sio5 transmit buffer empty interrupt sio4, 5 transmit/receive interrupt (group interrupt) sio5 receive-finished sio4, 5 transmit/receive interrupt (group interrupt) or receive error interrupt (selectable) table 12.1.3 serial i/o dma transfer request generation function serial i/o dma transfer request dmac input channel sio0 transmit buffer empty channel 3 sio0 receive-finished channel 4 sio1 transmit buffer empty channel 6 sio1 receive-finished channel 3 sio2 transmit buffer empty channel 7 sio2 receive-finished channel 5 sio3 transmit buffer empty channel 9 sio3 receive-finished channel 8 serial i/o 12.1 outline of serial i/o
12 12-5 ver.0.10 figure 12.1.1 block diagram of sio0-sio5 note 1 : when bclk is selected, the brg set value is subject to limitations. note 2 : sio2 and sio3 do not have the sclki/sclko function. sclki0/ sclko0 bclk, bclk/8, bclk/32, bclk/256 baud rate generator (brg) bclk (set value + 1) 1 internal data bus csio mode when internal clock selected when uart mode selected csio mode uart mode when internal clock selected 1/16 1/2 clock divider rxd0 txd0 receive interrupt transmit/receive control circuit sio0 transmit buffer register sio0 transmit shift register receive dma transfer request transmit interrupt transmit dma transfer request to dmac3 sio0 receive shift register sio0 receive buffer register when external clock selected sio0 sio1 sio2 sio3 rxd1 txd1 sio1 transmit shift register sio1 receive shift register rxd2 txd2 rxd3 txd3 to interrupt controller to dmac4 sio4 rxd4 txd4 sio5 rxd5 txd5 sclki4 / sclko4 sclki5 / sclko5 receive interrupt transmit/receive control circuit receive dma transfer request transmit interrupt transmit dma transfer request sclki1/ sclko1 to dmac6 to interrupt controller to dmac3 sio2 transmit shift register sio2 receive shift register receive interrupt transmit/receive control circuit receive dma transfer request transmit interrupt transmit dma transfer request to dmac7 to dmac5 sio3 transmit shift register sio3 receive shift register receive interrupt transmit/receive control circuit receive dma transfer request transmit interrupt transmit dma transfer request to dmac9 to dmac8 to interrupt controller sio4 transmit shift register sio4 receive shift register receive interrupt transmit/receive control circuit transmit interrupt sio5 transmit shift register sio5 receive shift register receive interrupt transmit/receive control circuit transmit interrupt to interrupt controller serial i/o 12.1 outline of serial i/o
12 12-6 ver.0.10 serial i/o 12.2 serial i/o related registers 12.2 serial i/o related registers the diagram below shows a serial i/o related register map. figure 12.2.1 serial i/o related register map address d0 d7 +0 address +1 address d8 d15 h'0080 0100 h'0080 0112 h'0080 0120 h'0080 0130 h'0080 0124 h'0080 0126 blank addresses are reserved. h'0080 0102 sio03 cause of receive interrupt select register (si03sel) h'0080 0110 h'0080 0116 sio0 transmit buffer register (s0txb) h'0080 0114 h'0080 0122 h'0080 0132 h'0080 0134 h'0080 0136 h'0080 0140 h'0080 0142 h'0080 0144 h'0080 0146 h'0080 0a00 h'0080 0a02 h'0080 0a10 h'0080 0a12 h'0080 0a14 sio23 interrupt status register (si23stat) sio03 interrupt mask register (si03mask) h'0080 0a16 h'0080 0a20 h'0080 0a22 h'0080 0a24 h'0080 0a26 sio0 transmit control register (s0tcnt) sio0 transmit/receive mode register (s0mod) sio0 receive buffer register (s0rxb) sio0 receive control register (s0rcnt) sio0 baud rate register (s0baur) sio1 transmit buffer register (s1txb) sio1 transmit control register (s1tcnt) sio1 receive buffer register (s1rxb) sio1 receive control register (s1rcnt) sio1 baud rate register (s1baur) sio1 transmit/receive mode register (s1mod) sio2 transmit buffer register (s2txb) sio2 transmit control register (s2tcnt) sio2 receive buffer register (s2rxb) sio2 receive control register (s2rcnt) sio2 baud rate register (s2baur) sio2 transmit/receive mode register (s2mod) sio3 transmit buffer register (s3txb) sio3 transmit control register (s3tcnt) sio3 receive buffer register (s3rxb) sio3 receive control register (s3rcnt) sio3 baud rate register (s3baur) sio3 transmit/receive mode register (s3mod) sio4 transmit buffer register (s4txb) sio4 transmit control register (s4tcnt) sio4 receive buffer register (s4rxb) sio4 receive control register (s4rcnt) sio4 baud rate register (s4baur) sio4 transmit/receive mode register (s4mod) sio45 cause of receive interrupt select register (si45sel) sio45 interrupt status register (si45stat) sio45 interrupt mask register (si45mask) sio5 transmit buffer register (s5txb) sio5 transmit control register (s5tcnt) sio5 receive buffer register (s5rxb) sio5 receive control register (s5rcnt) sio5 baud rate register (s5baur) sio5 transmit/receive mode register (s5mod)
12 12-7 ver.0.10 serial i/o 12.2 serial i/o related registers 12.2.1 sio interrupt related registers (1) selecting the cause of interrupt interrupt signals sent from each sio to the icu (interrupt controller) are broadly classified into transmit interrupts and receive interrupts. transmit interrupts are generated when the transmit buffer is empty. receive interrupts are either receive-finished interrupts or receive error interrupts as selected by the cause of receive interrupt select register (si03sel, si45sel). note 1 : no interrupt signals are generated unless interrupts are enabled by the sio interrupt mask register after enabling the ten (transmit enable) bit or ren (receive enable) bit for the corresponding sio. note 2 : sio2 and sio3 together comprise one interrupt group, so do sio4 and sio5. (2) precautions on using transmit interrupts transmit interrupts are generated when the corresponding ten (transmit enable) bit is enabled while the sio interrupt mask register is set to enable interrupts. (3) about dma transfer requests from sio each sio can generate a transmit dma transfer and a receive-finished dma transfer request. these dma transfer requests can be generated by enabling each sio's corresponding ten (transmit enable) bit or ren (receive enable) bit. when using dma transfers to communicate with external devices, be sure to set the dmac before enabling the ten or ren bits. when a receive error occurs, no receive-finished dma transfer requests are generated. ?transmit dma transfer request generated when the transmit buffer is empty and the ten bit is enabled. figure 12.2.2 transmit dma transfer request ten (transmit enable bit) tbe (transmit buffer empty bit) transmit dma transfer request
12 12-8 ver.0.10 serial i/o 12.2 serial i/o related registers receive-finished dma transfer request dma transfer request is generated when the receive buffer is filled. figure 12.2.3 receive-finished dma transfer request receive dma transfer request rfin (receive-completed bit) note : when a receive error occurs, no receive-finished dma transfer requests are generated.
12 12-9 ver.0.10 serial i/o 12.2 serial i/o related registers d0123456d7 irqt2 irqr2 irqt3 irqr3 d bit name function r w 0 - 3 no functions assigned 0 4 irqt2 (sio2 transmit-finished 0 : interrupt not requested interrupt request status bit) 1 : interrupt requested 5 irqr2 (sio2 receive interrupt 0 : interrupt not requested request status bit) 1 : interrupt requested 6 irqt3 (sio3 transmit-finished 0 : interrupt not requested interrupt request status bit) 1 : interrupt requested 7 irqr3 (sio3 receive interrupt 0 : interrupt not requested request status bit) 1 : interrupt requested w = : only writing a 0 is effective; when you write a 1, the previous value is retained. transmit/receive interrupt requests from sio2 and sio3 are described below. [setting the interrupt request status bit] this bit can only be set in hardware, and cannot be set in software. [clearing the interrupt request status bit] this bit is cleared by writing a 0 in software. note : if the status bit is set in hardware at the same time it is cleared in software, the former has priority and the status bit is set. when writing to the sio interrupt status register, make sure the bits you want to clear are set to 0 and all other bits are set to 1. the bits which are thus set to 1 are unaffected by writing in software and retain the value they had before you write. 12.2.2 sio interrupt control registers  sio23 interrupt status register (si23stat)
12 12-10 ver.0.10 serial i/o 12.2 serial i/o related registers d0123456d7 irqt4 irqr4 irqt5 irqr5 d bit name function r w 0 irqt4 (sio4 transmit-finished 0 : interrupt not requested interrupt request status bit) 1 : interrupt requested 1 irqr4 (sio4 receive interrupt 0 : interrupt not requested request status bit) 1 : interrupt requested 2 irqt5 (sio5 transmit-finished 0 : interrupt not requested interrupt request status bit) 1 : interrupt requested 3 irqr5 (sio5 receive interrupt 0 : interrupt not requested request status bit) 1 : interrupt requested 4 - 7 no functions assigned 0 w = : only writing a 0 is effective; when you write a 1, the previous value is retained. transmit/receive interrupt requests from sio4 and sio5 are described below. [setting the interrupt request status bit] this bit can only be set in hardware, and cannot be set in software. [clearing the interrupt request status bit] this bit is cleared by writing a 0 in software. note : if the status bit is set in hardware at the same time it is cleared in software, the former has priority and the status bit is set. when writing to the sio interrupt status register, make sure the bits you want to clear are set to 0 and all other bits are set to 1. the bits which are thus set to 1 are unaffected by writing in software and retain the value they had before you write.  sio45 interrupt status register (si45stat)
12 12-11 ver.0.10 serial i/o 12.2 serial i/o related registers d8 9 1011121314d15 t0mask r0mask t1mask r1mask t2mask r2mask t3mask r3mask d bit name function r w 8 t0mask (sio0 transmit 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 9 r0mask (sio0 receive 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 10 t1mask (sio1 transmit 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 11 r1mask (sio1 receive 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 12 t2mask (sio2 transmit 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 13 r2mask (sio2 receive 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 14 t3mask (sio3 transmit 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 15 r3mask (sio3 receive 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request this register enables or disables interrupt requests generated by each sio. interrupt requests from an sio are enabled by setting its corresponding interrupt mask bit to 1.  sio03 interrupt mask register (si03mask)
12 12-12 ver.0.10 serial i/o 12.2 serial i/o related registers d8 9 1011121314d15 t4mask r4mask t5mask r5mask d bit name function r w 8 t4mask (sio4 transmit 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 9 r4mask (sio4 receive 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 10 t5mask (sio5 transmit 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 11 r5mask (sio5 receive 0 : masks (disables) interrupt request interrupt mask bit) 1 : enables interrupt request 12 - 15 no functions assigned 0 this register enables or disables interrupt requests generated by each sio. interrupt requests from an sio are enabled by setting its corresponding interrupt mask bit to 1.  sio45 interrupt mask register (si45mask)
12 12-13 ver.0.10 serial i/o 12.2 serial i/o related registers d0123456d7 isr0 isr1 isr2 isr3 d bit name function r w 0 - 3 no functions assigned 0 4 isr0 (sio0 receive interrupt 0 : receive-finished interrupt cause select bit) 1 : receive error interrupt 5 isr1 (sio1 receive interrupt 0 : receive-finished interrupt cause select bit) 1 : receive error interrupt 6 isr2 (sio2 receive interrupt 0 : receive-finished interrupt cause select bit) 1 : receive error interrupt 7 isr3 (sio3 receive interrupt 0 : receive-finished interrupt cause select bit) 1 : receive error interrupt this register selects the cause of an interrupt generated at completion of receive operation. [when set to 0] receive-finished interrupt (receive buffer full) is selected. receive-finished interrupts occur for receive errors (except an overrun error), as well as for completion of receive operation. [when set to 1] receive error interrupt is selected. the following lists the types of errors detected for reception errors. csio mode : overrun error uart mode : overrun error, parity error, and framing error  sio03 cause of receive interrupt select register (si03sel)
12 12-14 ver.0.10 serial i/o 12.2 serial i/o related registers d0123456d7 isr4 isr5 d bit name function r w 0 - 3 no functions assigned 0 4 isr4 (sio4 receive interrupt 0 : receive-finished interrupt cause select bit) 1 : receive error interrupt 5 isr5 (sio5 receive interrupt 0 : receive-finished interrupt cause select bit) 1 : receive error interrupt 6 - 7 no functions assigned 0 this register selects the cause of an interrupt generated at completion of receive operation. [when set to 0] receive-finished interrupt (receive buffer full) is selected. receive-finished interrupts occur for receive errors (except an overrun error), as well as for completion of receive operation. [when set to 1] receive error interrupt is selected. the following lists the types of errors detected for reception errors. csio mode : overrun error uart mode : overrun error, parity error, and framing error  sio45 cause of receive interrupt select register (si45sel)
12 12-15 ver.0.10 serial i/o 12.2 serial i/o related registers figure 12.2.5 block diagram of sio4,5 transmit interrupts figure 12.2.4 block diagram of sio2,3 transmit interrupts sio2,3 transmit/receive interrupts data bus b4 irqt2 f/f t2mask f/f b12 (level) 4-source inputs txd2 f/f isr2 rxd2 receive-finished rxd2 receive error b6 f/f isr3 rxd3 receive-finished rxd3 receive error b7 b5 irqr2 f/f r2mask f/f b13 b6 irqt3 f/f t2mask f/f b14 txd3 b7 irqr3 f/f r2mask f/f b15 sio4,5 transmit/receive interrupts data bus b0 irqt4 f/f t4mask f/f b8 (level) 4-source inputs txd4 f/f isr4 rxd4 receive-finished rxd4 receive error b4 f/f isr5 rxd5 receive-finished rxd5 receive error b5 b1 irqr4 f/f r2mask f/f b9 b2 irqt5 f/f t2mask f/f b10 txd5 b3 irqr5 f/f r2mask f/f b11
12 12-16 ver.0.10 serial i/o 12.2 serial i/o related registers d0123456d7 cdiv tstat tbe ten d bit name function r w 0 , 1 no functions assigned 0 2 , 3 cdiv d2 d3 (brg count source select bit) 0 0 : selects f(bclk) 0 1 : selects divided-by-8 f(bclk) 1 0 : selects divided-by-32 f(bclk) 1 1 : selects divided-by-256 f(bclk) 4 no functions assigned 0 5 tstat 0 : transmit halted & no data (transmit status bit) in transmit buffer register 1 : transmit in progress or data exists in transmit buffer register 6 tbe 0 : data exists in transmit buffer register (transmit buffer empty bit) 1 : no data in transmit buffer register 7 ten 0 : disables transmit (transmit enable bit) 1 : enables transmit 12.2.3 sio transmit control registers  sio0 transmit control register (s0tcnt)  sio1 transmit control register (s1tcnt)  sio2 transmit control register (s2tcnt)  sio3 transmit control register (s3tcnt)  sio4 transmit control register (s4tcnt)  sio5 transmit control register (s5tcnt)
12 12-17 ver.0.10 serial i/o 12.2 serial i/o related registers (1) cdiv (baud rate generator count source select) bits (d2, d3) these bits select the count source for the baud rate generator (brg). note : if f(bclk) is selected as the count source for the brg, make sure when you set brg that the baud rate will not exceed the maximum transfer rate. for details, refer to the section of this manual where the brg register is described. (2) tstat (transmit status) bit (d5) [set condition] this bit is set to 1 by a write to the transmit buffer register when transmit is enabled. [clear condition] this bit is cleared to 0 when transmit is idle (no data in the transmit shift register) and no data exists in the transmit buffer register. this bit also is cleared by clearing the transmit enable bit. (3) tbe (transmit buffer empty) bit (d6) [set condition] this bit is set to 1 when data is transferred from the transmit buffer register to the transmit shift register and the transmit buffer register becomes empty. this bit also is set by clearing the transmit enable bit. [clear condition] this bit is cleared to 0 by writing data to the lower byte of the transmit buffer register when transmit is enabled (ten = 1). (4) ten (transmit enable) bit (d7) transmit is enabled by setting this bit to 1 and disabled by clearing this bit to 0. if this bit is cleared to 0 while transmitting data, the transmit operation stops.
12 12-18 ver.0.10 serial i/o 12.2 serial i/o related registers d8 9 1011121314d15 smod cks stb psel pen sen d bit name function r w 8 - 10 smod d8 d9 d10 (serial i/o mode select bit) 0 0 0 : 7-bit uart (note 1) 0 0 1 : 8-bit uart 0 1 x : 9-bit uart 1 x x : 8-bit clock-synchronized serial i/o 11 cks 0 : internal clock (internal/external clock select bit) 1 : external clock (note 2) 12 stb (stop bit length select bit, 0 : one stop bit uart mode only) 1 : two stop bits (note 3) 13 psel (parity odd/even select bit, 0 : odd parity uart mode only) 1 : even parity (note 3) 14 pen (parity enable bit, 0 : disables parity uart mode only) 1 : enables parity (note 3) 15 sen (sleep select bit, 0 : disables sleep function uart mode only) 1 : enables sleep function (note 3) note 1 : for sio2 and 3, the d8 bit is fixed to 0 in hardware. you cannot set the d8 bit to 1 (to choose clock- synchronous serial i/o). note 2 : has no effect when uart mode is selected. note 3 : d12 to d15 have no effect during clock-synchronous mode. 12.2.4 sio transmit/receive mode registers  sio0 mode register (s0mod)  sio1 mode register (s1mod)  sio2 mode register (s2mod)  sio3 mode register (s3mod)  sio4 mode register (s4mod)  sio5 mode register (s5mod)
12 12-19 ver.0.10 serial i/o 12.2 serial i/o related registers the sio mode register consists of bits to set the serial i/o operation mode, data format, and the functions used during communication. the sio transmit/receive mode register must always be set before serial i/o starts operating. if you want to change settings of this register after the serial i/o started transmitting or receiving data, be sure to confirm that transmit and receive operations have been completed and disable transmit/ receive operations (by clearing the sio transmit control register transmit enable bit and sio receive control register receive enable bit to 0) before you change. (1) smod (serial i/o mode select) bits (d8 to d10) these bits select the operation mode of serial i/o. (2) cks (internal/external clock select) bit (d11) this bit is effective when csio mode is selected. setting this bit has no effect when uart mode is selected, in which case the serial i/o is clocked by an internal clock. (3) stb (stop bit length select) bit (d12) this bit is effective when uart mode is selected. use this bit to select the stop bit length that indicates the end of data to transmit. setting this bit to 0 selects one stop bit, and setting this bit to 1 selects two stop bits. during clock-synchronous mode, the content of this bit has no effect. (4) psel (parity odd/even select) bit (d13) this bit is effective during uart mode. when parity is enabled (d14 = 1), use this bit to select the parity attribute (whether odd or even). setting this bit to 0 selects an odd parity, and setting this bit to 1 selects an even parity. when parity is disabled (d14 = 0) and during clock-synchronous mode, the content of this bit has no effect. (5) pen (parity enable) bit (d14) this bit is effective during uart mode. when this bit is set to 1, a parity bit is added immediately after the data bits of transmit data, and for receive data, the parity in it is checked. the parity bit added to the transmit data is automatically determined to be a 1 or a 0 in such a way that the attribute (odd/even) of the sum of the number of 1's in data bits and the content of the parity bit agrees with one selected by the parity odd/even select bit (d13). figure 12.2.4 shows an example of data format when parity is enabled. (6) sen (sleep select) bit (d15) this bit is effective during uart mode. if the sleep function is enabled by setting this bit to 1, data is latched into the uart receive buffer register only when the most significant bit (msb) of the received data is 1.
12 12-20 ver.0.10 serial i/o 12.2 serial i/o related registers figure 12.2.4 data format when parity is enabled st : start bit par : parity bit : one frame equivalent d : data bit sp : stop bit if the attribute (odd/even) of the number of 1's included in data bits agrees with the selected parityattribute, a 0 is added as parity bit. if the attribute (odd/even) of the number of 1's included in data bits does not agree with the selected parity attribute, a 1 is added as parity bit. d7 d6 d5 d4 d3 d2 d1 d0 par sp st attribute of d7 + d6 + ... +d0 when it agrees with the selected parity attribute, par = 0 is added. lsb msb if the result of d7 + d6 + ... d0 + par does not agree with the selected parity attribute, a parity error is assumed. note 1: shown above is an example of data format in 8-bit uart mode. note 2: the data bit numbers (dn) above indicate bit numbers in a data list, and not the register bit numbers (dn).  9-bit uart mode  8-bit uart mode d6 d5 d4 d3 d2 d1 d0 par sp st note 1 note 2  7-bit uart mode d7 d6 d5 d4 d3 d2 d1  clock-synchronous mode d0 note 1: whether or not to add a parity bit is selectable. note 2: the stop bit can be one bit or two bits long as selected. direction of transfer d6 d5 d4 d3 d2 d1 d0 par sp st note 1 note 2 d7 d6 d5 d4 d3 d2 d1 d0 par sp st note 1 note 2 d7 d8  when transmitting received data is checked to see if the number of 1's included in its data bits and the parity bit agrees with the parity attribute (known as parity check).  when receiving when it agrees with the selected parity attribute, par = 0 is added. d7 d6 d5 d4 d3 d2 d1 d0 par sp st lsb msb
12 12-21 ver.0.10 serial i/o 12.2 serial i/o related registers d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 tdata d bit name function r w 0 - 6 no functions assigned ? 7 - 15 tdata sets transmit data. ? (transmit data) r = ? : indeterminate when read the sion transmit buffer register is used to set transmit data. this register is a write-only register, so you cannot read out the content of this register. set data lsb-aligned, and write transmit data to bits d9-d15 for 7-bit data (uart mode only), d8-d15 for 8-bit data, or d7-d15 for 9-bit data (uart mode only). before you set data in this register, enable the transmit control register ten (transmit enable) bit by setting it to 1. writing data to this register while the ten bit is disabled (cleared to 0) has no effect. when data is written to the transmit buffer register while transmit is enabled, the data is transferred from the sio transmit buffer register to the sio transmit shift register, upon which the serial i/o starts transmitting the data. note : for 7-bit and 8-bit data, the register can be accessed bytewise. 12.2.5 sio transmit buffer registers  sio0 transmit buffer register (s0txb)  sio1 transmit buffer register (s1txb)  sio2 transmit buffer register (s2txb)  sio3 transmit buffer register (s3txb)  sio4 transmit buffer register (s4txb)  sio5 transmit buffer register (s5txb)
12 12-22 ver.0.10 serial i/o 12.2 serial i/o related registers d01234567891011121314d15 rdata d bit name function r w 0 - 6 no functions assigned 0 8 - 15 rdata stores receive data. (receive data) the sion receive buffer register is used to store the receive data. when the serial i/o finishes receiving data, the content of the sio receive shift register is transferred to the sio receive buffer register. this register is a read-only register. for 7-bit data (uart mode only), data is set in bits d9-d15, with d8 and d7 always set to 0. for 8- bit data, data is set in bits d8-d15, with d7 always set to 0. after reception is completed, you may read out the content of the sio receive buffer register, but if the serial i/o finishes receiving the next data before you read the previous data, an overrun error occurs. in this case, the data received thereafter is not transferred to the receive buffer register. to restart reception normally, clear the receive control register's ren (receive enable) bit to 0. note : for 7-bit and 8-bit data, the register can be accessed bytewise. 12.2.6 sio receive buffer registers  sio0 receive buffer register (s0rxb)  sio1 receive buffer register (s1rxb)  sio2 receive buffer register (s2rxb)  sio3 receive buffer register (s3rxb)  sio4 receive buffer register (s4rxb)  sio5 receive buffer register (s5rxb)
12 12-23 ver.0.10 serial i/o 12.2 serial i/o related registers d0123456d7 rstat rfin ren ovr pty flm ers d bit name function r w 0 no functions assigned 0 1 rstat 0 : reception stopped (receive status bit) 1 : reception in progress 2 rfin 0 : no data in receive buffer register (receive completed bit) 1 : data exists in receive buffer register 3 ren 0 : disables reception (receive enable bit) 1 : enables reception 4 ovr 0 : no overrun error (overrun error bit) 1 : overrun error occurred 5 pty 0 : no parity error (parity error bit, uart mode only) 1 : parity error occurred 6 flm 0 : no framing error (framing error bit, uart mode only) 1 : framing error occurred 7 ers 0 : no error (error sum bit) 1 : error occurred 12.2.7 sio receive control registers  sio0 receive control register (s0rcnt)  sio1 receive control register (s1rcnt)  sio2 receive control register (s2rcnt)  sio3 receive control register (s3rcnt)  sio4 receive control register (s4rcnt)  sio5 receive control register (s5rcnt)
12 12-24 ver.0.10 serial i/o 12.2 serial i/o related registers (1) rstat (receive status) bit (d1) [set condition] this bit is set to 1 by a start of receive operation. when this bit = 1, it means that the serial i/o is receiving data. [clear condition] this bit is cleared to 0 upon completion of receive operation or by clearing the ren (receive enable) bit. (2) rfin (receive completed) bit (d2) [set condition] this bit is set to 1 when all data bits have been received in the receive shift register and whose content is transferred to the receive buffer register. [clear condition] this bit is cleared to 0 by reading the lower byte from the receive buffer register or by clearing the ren (receive enable) bit. however, if an overrun error occurs, this bit cannot be cleared by reading the lower byte from the receive buffer register. in this case, clear the ren (receive enable) bit. (3) ren (receive enable) bit (d3) receive is enabled by setting this bit to 1, and is disabled by clearing this bit to 0, at which time the receive unit is initialized. accordingly, the receive status flag, receive-completed flag bit, overrun error flag, framing error flag, parity error flag, and error sum flag all are cleared. the receive operation stops when the receive enable bit is cleared to 0 while receiving data. (4) ovr (overrun error) bit (d4) [set condition] this bit is set to 1 when all bits of the next receive data have been received in the receive shift register while the receive buffer register still contains the previous receive data. in this case, the receive data is not stored in the receive buffer register. although receive operation is continued when the overrun error flag = 1, the receive data is not stored in the receive buffer register. to start reception normally, you need to clear this bit. [clear condition] this bit is cleared to 0 by only clearing the ren (receive enable) bit.
12 12-25 ver.0.10 serial i/o 12.2 serial i/o related registers (5) pty (parity error) bit (d5) this bit is effective in only uart mode. during csio mode, this bit is fixed to 0. [set condition] the pty (parity error) bit is set to 1 when the sio transmit/receive mode register's pen (parity enable/disable) bit is enabled and the parity (even/odd) of the receive data does not agree with the value that has been set by the said register's psel bit (parity select) bit. [clear condition] the pty bit is cleared by reading the lower byte from the sio receive buffer register or by clearing the sio receive control register's ren (receive enable) bit. however, if an overrun error occurs, this bit cannot be cleared by reading the lower byte from the receive buffer register. in this case, clear the ren (receive enable) bit. (6) flm (framing error) bit (d6) this bit is effective in only uart mode. during csio mode, this bit is fixed to 0. [set condition] the flm (framing error) bit is set to 1 when the number of received bits does not agree with one that has been selected by the sio transmit/receive mode register. however, if an overrun error occurs, this bit cannot be cleared by reading the lower byte from the receive buffer register. in this case, clear the ren (receive enable) bit. [clear condition] the flm bit is cleared by reading the lower byte from the sio receive buffer register or by clearing the sio receive control register's ren (receive enable) bit (7) ers (error sum) bit (d7) [set condition] this flag is set to 1 when any one of overrun, framing, or parity errors is detected at completion of reception. [clear condition] if an overrun has occurred, this flag is cleared by clearing the ren (receive enable) bit. otherwise, this flag is cleared by reading the lower byte from the receive buffer register or clearing the sio receive control register's ren (receive enable) bit.
12 12-26 ver.0.10 serial i/o 12.2 serial i/o related registers d8 9 1011121314d15 brg d bit name function r w 8 - 15 brg divides the baud rate count source selected (baud rate divide value) by sio mode register by (n + 1) according to the brg set value 'n.' brg (baud rate divide value) (d8-d15) the sio baud rate register divides the baud rate count source selected by sio mode register by (brg set value + 1) according to the brg set value. in the initial state, the brg value is indeterminate, so be sure to set the divide value before serial i/o starts operating. the value written to the brg during transmit/receive operation takes effect in the next cycle after the brg counter finished counting. when using the internal clock (to output the sclko signal) in csio mode, the serial i/o divides the internal bclk using the clock divider. next, it divides the resulting clock by (brg set value + 1) according to the brg set value and then by 2, which results in generating a transmit/receive shift clock. when using an external clock in csio mode, the serial i/o does not use the brg. (transmit/ receive operations are synchronized to the externally supplied clock.) 12.2.8 sio baud rate registers  sio0 baud rate register (s0baur)  sio1 baud rate register (s1baur)  sio2 baud rate register (s2baur)  sio3 baud rate register (s3baur)  sio4 baud rate register (s4baur)  sio5 baud rate register (s5baur)
12 12-27 ver.0.10 serial i/o 12.2 serial i/o related registers in uart mode, the serial i/o divides the internal bclk using the clock divider. next, it divides the resulting clock by (brg set value + 1) according to the brg set value and then by 16, which results in generating a transmit/receive shift clock. when using sio0, sio1, sio4 or sio5 in uart mode, you can choose the relevant port (p84, p87, p65 or p66) to function as the sclko pin, so that a divided-by-2 brg output clock can be output from the sclko pin. when using the internal clock (internally clocked csio or uart mode), with f(bclk) selected as the brg count source, make sure that during csio mode, the transfer rate does not exceed 2 mbits per second, and that during uart mode, brg is equal to or greater than 7.
12 12-28 ver.0.10 serial i/o 12.3 transmit operation in csio mode 12.3 transmit operation in csio mode 12.3.1 setting the csio baud rate the baud rate (data transfer rate) in csio mode is determined by a transmit/receive shift clock. the clock source from which to generate the transmit/receive shift clock is selected from the internal clock f(bclk) or external clock. the cks (internal/external clock select) bit (sio transmit/receive mode register d11 bit) is used to select the clock source. the equation by which to calculate the transmit/receive baud rate values differs with the selected clock source, whether internal or external. (1) when internal clock is selected in csio mode when the internal clock is selected, f(bclk) is divided by the clock divider before being fed into the baud rate generator (brg). the clock divider's divide-by value is selected from 1, 8, 32, or 256 by using the cdiv (baud rate generator count source select) bits (transmit control register d2, d3 bits). the baud rate generator divides the clock divider output by (baud rate register set value + 1) and then by 2, which results in generating a transmit/receive shift clock. when the internal clock is selected in csio mode, the baud rate is calculated using the equation below. 1 (bclk) baud rate = [bps] clock divider's divide-by value (baud rate register set value + 1) 2 baud rate register set value = h'00 to h'ff (note) clock divider's divide-by value = 1, 8, 32, or 256 note : if the divide-by value selected for the baud rate generator count source is "1" (i.e., f(bclk) itself), make sure the baud rate register value you set does not exceed 2 mbps. (2) when external clock is selected in csio mode in this case, the baud rate generator is not used; instead, the input clock from the sclki pin serves directly as csio transmit/receive shift clock. the maximum frequency of the sclki pin input clock is 1/16 of f(bclk). baud rate = sclki pin input clock [bps]
12 12-29 ver.0.10 12.3.2 initial settings for csio transmission to transmit data in csio mode, initialize the serial i/o following the procedure described below. (1) setting sio transmit/receive mode register set the register to csio mode select the internal or an external clock (2) setting sio transmit control register select the clock divider's divide-by ratio (when internal clock selected) (3) setting sio baud rate register when the internal clock is selected, set a baud rate generator value. (refer to section 12.3.1, "setting the csio baud rate.") (4) setting sio interrupt mask register enable or disable the transmit buffer empty interrupt (sio interrupt mask register) (5) setting the interrupt controller (sio transmit interrupt control register) when you use a transmit buffer empty interrupt during transmission, set its priority level. (6) setting dmac when you issue dma transfer requests to the internal dmac when the transmit buffer is empty, set the dmac. (refer to chapter 9, "dmac.") (7) selecting pin functions because the serial i/o related pins serve dual purposes (shared with input/output ports), set pin functions. (refer to chapter 8, "input/output ports and pin functions.") serial i/o 12.3 transmit operation in csio mode
12 12-30 ver.0.10 serial i/o 12.3 transmit operation in csio mode figure 12.3.1 procedure for csio transmit initialization note 1 : this is necessary when you use the internal clock. note 2 : when you selected the internal clock and a divide-by ratio = 1, you are subject to limitations that the baud rate generator must be set not to exceed 2 mbps. set sio transmit/receive mode register initial settings for csio transmission set register to csio mode select internal or external clock (when using dmac) set dmac (when using interrupt) set the interrupt controller enable/disable transmit buffer empty interrupt set sio interrupt mask register divide-by ratio h'00 to h'ff (note 2) set sio baud rate register select clock divider's divide-by ratio (note 1) set sio transmit control register set input/output port operation mode register serial i/o related registers initial settings for csio transmission finished
12 12-31 ver.0.10 serial i/o 12.3 transmit operation in csio mode 12.3.3 starting csio transmission when all of the following transmit conditions are met after you finished initialization, the serial i/o starts transmit operation. (1) transmit conditions when csio mode internal clock is selected the sio control register's transmit enable bit is set to 1. transmit data (8 bits) is written to the lower byte of the sio transmit buffer register (transmit buffer empty bit = 0). (2) transmit conditions when csio mode external clock is selected the sio control register 0's transmit enable bit is set to 1. transmit data is written to the lower byte of the sio transmit buffer register (transmit buffer empty bit = 0). a falling edge of transmit clock on the sclki pin is detected. note 1 : while the transmit enable bit is cleared to 0, writes to the transmit buffer register are ignored. always be sure to set the transmit enable bit to 1 before you write to the transmit buffer register. note 2 : when the internal clock is selected, a write to the lower byte of the transmit buffer register in note 1 above triggers a start of transmission. note 3 : the transmit status bit is set to 1 at the time data is set in the lower byte of the sio transmit buffer register. when transmission starts, the serial i/o transmits data following the procedure below. transfer the content of the sio transmit buffer register to the sio transmit shift register. set the transmit buffer empty bit to 1. (note) start sending data synchronously with the shift clock beginning with the lsb. note : a transmit buffer empty interrupt request and/or a dma transfer request can be generated when the transmit buffer is emptied. 12.3.4 successive csio transmission once data is transferred from the transmit buffer register to the transmit shift register, the next data can be written to the transmit buffer register even when transmission of the preceding data is not completed. when the next data is written to the transmit buffer before completion of the preceding data transmission, the preceding and the next data are successively transmitted. to see if data has been transferred from the transmit buffer register to the transmit shift register, check the sio status register's transmit buffer empty flag.
12 12-32 ver.0.10 serial i/o 12.3 transmit operation in csio mode 12.3.5 processing at end of csio transmission when data transmission is completed, the following operation is automatically performed in hardware. (1) when not transmitting successively the transmit status bit is set to 0. (2) when transmitting successively when transmission of the last data in a consecutive data train is completed, the transmit status bit is set to 0. 12.3.6 transmit interrupt if a transmit buffer empty interrupt has been enabled by the sio interrupt mask register, a transmit buffer empty interrupt is generated at the time data is transferred from the transmit buffer register to the transmit shift register. also, a transmit buffer empty interrupt is generated when the ten (transmit enable) bit is set to 1 (enabled after being disabled) while a transmit buffer empty interrupt has been enabled. you must set the interrupt controller (icu) before you can use transmit interrupts. 12.3.7 transmit dma transfer request when data has been transferred from the transmit buffer register to the transmit shift register, a transmit dma transfer request for the corresponding sio channel is ouput to the dmac. this transfer request is also output when the ten (transmit enable) bit is set to 1 (enabled after being disabled). you must set the interrupt controller (icu) before you can transmit data using dma transfers.
12 12-33 ver.0.10 serial i/o 12.3 transmit operation in csio mode figure 12.3.2 transmit operation during csio mode (hardware processing) note : this applies when transmit interrupt has been enabled by sio interrupt mask register. the following processing is automatically executed in hardware transfer content of transmit buffer to transmit shift register set transmit buffer empty bit to 1 transmit data y (successive transmission) transmit conditions met? y n n clear transmit status bit to 0 transmit dma transfer request transmit interrupt request (note) csio transmit operation starts csio transmit operation completed transmit conditions met?
12 12-34 ver.0.10 serial i/o 12.3 transmit operation in csio mode figure 12.3.3 example of csio transmission (transmitted only once, with transmit interrupt used) note 1 : change of the interrupt controller "sio transmit interrupt control register" interrupt request bit note 2 : when transmit interrupt is enabled (dma transfer can also be requested at the same timing) note 3 : the interrupt controller ivect register is read or "sio transmit interrupt control register" interrupt request bit cleared note 4 : transmit interrupt request is generated when transmission is enabled. note 5 : even after transmit data is written to the transmit buffer, a transmit interrupt request is generated when the data is transferred from the transmit buffer to the transmit shift register and the transmit buffer is thereby emptied. 12.3.8 typical csio transmit operation the following shows a typical transmit operation in csio mode. : processing by software : interrupt generation internal clock selected external clock selected sclko txd sclki rxd transmit clock (sclko) set write to transmit buffer register transmit buffer empty bit transmit enable bit cleared transmit status bit d7 d6 d5 d4 d3 d2 d1 d0 txd sio transmit interrupt (note 1) transmit interrupt (note 4) interrupt request accepted content of transmit buffer register transferred to transmit shift register cleared by completion of transmission set by a write to transmit buffer (note 2) (note 3) transmit interrupt (note 5)
12 12-35 ver.0.10 serial i/o 12.3 transmit operation in csio mode figure 12.3.4 example of csio transmission (successive transmission, with transmit buffer empty and transmit finished interrupts used) note 1 : change of the interrupt controller "sio transmit interrupt control register" interrupt request bit note 2 : when transmit interrupt is enabled (dma transfer can also be requested at the same timing) note 3 : transmit interrupt request is generated when transmission is enabled. note 4 : even after transmit data is written to the transmit buffer, a transmit interrupt request is generated when the data is transferred from the transmit buffer to the transmit shift register and the transmit buffer is thereby emptied. : interrupt generation first data next data (note 2) (note 3) (note 2) upon transmit buffer empty interrupt, next data is written (first data) (next data) (note 4) : processing by software internal clock selected external clock selected sclko txd sclki rxd transmit clock (sclko) set transmit buffer empty bit transmit enable bit cleared transmit status bit d7 d6 d5 d0 d7 d6 d5 d0 txd sio transmit interrupt (note 1) write to transmit buffer register write to transmit buffer register
12 12-36 ver.0.10 serial i/o 12.4 receive operation in csio mode 12.4 receive operation in csio mode 12.4.1 initial settings for csio reception to receive data in csio mode, initialize the serial i/o following the procedure described below. note, however, that because the receive shift clock is derived from operation of the transmit circuit, you need to execute transmit operation even when you only want to receive data. (1) setting sio transmit/receive mode register set the register to csio mode select the internal or an external clock (2) setting sio transmit control register select the clock divider's divide-by ratio (when internal clock selected) (3) setting sio baud rate register when the internal clock is selected, set a baud rate generator value. (refer to section 12.3.1, "setting the csio baud rate.") (4) setting sio interrupt mask register enable or disable the transmit buffer empty interrupt (sio interrupt mask register) select the cause of receive interrupt (receive finished/error) (cause of receive interrupt select register) (5) setting sio receive control register set the receive enable bit (6) setting the interrupt controller (sio transmit interrupt control register) when you use a transmit interrupt or receive interrupt during transmission/reception, set its priority level. (7) setting the dmac when you generate a dma transfer request to the internal dmac when the transmit buffer is empty or transmission is completed, set the dmac. (refer to chapter 9, "dmac.")
12 12-37 ver.0.10 figure 12.4.1 procedure for csio receive initialization note 1 : this is necessary when you use the internal clock. note 2 : when you selected the internal clock and a divide-by ratio = 1, you are subject to limitations that the baud rate generator must be set not to exceed 2 mbps. (8) selecting pin functions because the serial i/o related pins serve dual purposes (shared with input/output ports), set pin functions. (refer to chapter 8, "input/output ports and pin functions.") set sio transmit/receive mode register initial settings for csio reception set to csio mode select internal or external clock (when using dmac) set dmac (when using interrupt) set the interrupt controller enable/disable transmit buffer empty interrupt set sio interrupt mask register divide-by ratio h'00 to h'ff (note 2) set sio baud rate register select clock divider's divide-by ratio (note 1) set sio transmit control register set input/output port operation mode register serial i/o related registers initial settings for csio reception finished set receive enable bit set sio receive control register serial i/o 12.4 receive operation in csio mode
12 12-38 ver.0.10 serial i/o 12.4 receive operation in csio mode 12.4.2 starting csio reception when all of the following receive conditions are met after you finished initialization, the serial i/o starts receive operation. (1) receive conditions when csio mode internal clock is selected the sio receive control register's receive enable bit is set to 1. transmit conditions are met. (refer to section 12.3.3, "starting csio transmission.") (2) receive conditions when csio mode external clock is selected the sio receive control register's receive enable bit is set to 1. transmit conditions are met. (refer to section 12.3.3, "starting csio transmission.") note : the receive status bit is set to 1 at the time dummy data is set in the lower byte of the sio transmit buffer register. when the above conditions are met, the serial i/o starts receiving 8-bit serial data (lsb first) synchronously with the receive shift clock. 12.4.3 processing at end of csio reception when data reception is completed, the following operation is automatically performed in hardware. (1) when reception is completed normally the receive-finished (receive buffer full) bit is set to 1. note 1 : if a receive-finished (receive buffer full) interrupt has been enabled, an interrupt request is generated. note 2 : a dma transfer request is generated. (2) when error occurs during reception when an error (only overrun error in csio mode) occurs during reception, the overrun error bit and receive sum bit are set to 1. note 1 : if a receive-finished interrupt has been selected (by sio cause of receive interrupt select register), neither a receive-finished interrupt request nor a dma transfer request is generated. note 2 : if a receive error interrupt has been selected (by sio cause of receive interrupt select register), a receive error interrupt request is generated when interrupt requests are enabled. no dma transfer requests are generated.
12 12-39 ver.0.10 figure 12.4.2 receive operation during csio mode (hardware processing) serial i/o 12.4 receive operation in csio mode 12.4.4 about successive reception when the following conditions are met at completion of data reception, data may be received successively. the receive enable bit is set to 1. transmit conditions are met. no overrun error has occurred. receive data set sio receive control register's receive-finished bit to 1 store received data in receive buffer register set sio receive control register's overrun error and receive sum error bits to 1 overrun error? receive conditions met? y n csio receive operation starts n y csio receive operation completed
12 12-40 ver.0.10 serial i/o 12.4 receive operation in csio mode 12.4.5 flags indicating the status of csio receive operation following flags are available that indicate the status of receive operation in csio mode. sio receive control register receive status bit sio receive control register receive-finished bit sio receive control register receive error bit sio receive control register overrun error bit after reception is completed, you may read out the content of the sio receive buffer register, but if the serial i/o finishes receiving the next data before you read, an overrun error occurs. in this case, the data received thereafter is not transferred to the sio receive buffer register. to restart reception, temporarily clear the receive enable bit to 0 and initialize the receive control block before you restart. the said receive enable bit can be cleared, when there are no receive errors(note) encountered, by reading the lower byte from the sio receive buffer register or clearing the ren (receive enable) bit. if any receive error has occurred, it can only be cleared by clearing the ren (receive enable) bit, and cannot be cleared by reading the lower byte from the sio receive buffer register. note : overrun error is the only error that can be detected during reception in csio mode.
12 12-41 ver.0.10 serial i/o 12.4 receive operation in csio mode figure 12.4.3 example of csio reception (when received normally) note 1 : change of the interrupt controller "sio receive interrupt control register" interrupt request bit note 2 : when receive-finished interrupt is enabled (dma transfer can also be requested at the same timing) note 3 : the interrupt controller ivect register is read or "sio receive interrupt control register" interrupt request bit cleared 12.4.6 typical csio receive operation the following shows a typical receive operation in csio mode. sio receive interrupt (note 1) (when receive-finished interrupt is selected) clock stopped automatically cleared for each receive operation performed receive-finished bit read from receive buffer (when receive error interrupt is selected) receive-finished interrupt (note 2) interrupt request accepted (note 3) no interrupt request internal clock selected external clock selected sclko rxd sclki txd receive clock (sclki) set receive enable bit cleared receive status bit set by a write to transmit buffer d7 d6 d5 d4 d3 d2 d1 d0 rxd : processing by software : interrupt generation
12 12-42 ver.0.10 serial i/o 12.4 receive operation in csio mode figure 12.4.4 example of csio reception (when overrun error occurred) note 1 : change of the interrupt controller "sio receive interrupt control register" interrupt request bit note 2 : when receive-finished interrupt is enabled note 3 : when receive error interrupt is enabled note 4 : receive enable bit cleared note 5 : the interrupt controller ivect register is read or "sio receive interrupt control register" interrupt request bit cleared first data reception completed overrun error bit receive buffer not read during this interval overrun error bit cleared (note 4) receive error interrupt (note 3) internal clock selected external clock selected sclko rxd sclki txd transmit clock (sclko) set receive enable bit cleared d7 d6 d0 d7 d6 d0 rxd set sio receive interrupt (note 1) (when receive-finished interrupt is selected) (when receive error interrupt is selected) receive-finished interrupt (note 2) interrupt request accepted (note 5) interrupt request accepted (note 5) : processing by software : interrupt generation next data reception completed receive-finished bit
12 12-43 ver.0.10 serial i/o 12.5 precautions on using csio mode 12.5 precautions on using csio mode ? settings of sio transmit/receive mode register and sio baud rate register the sio transmit/receive mode register and sio baud rate register and the transmit control register's brg count source select bit must always be set when not operating. when transmitting or receiving data, be sure to check that transmission and/or reception under way has been completed and clear the transmit and receive enable bits before you set the registers. ? settings of baud rate (brg) register if you selected f(bclk) with the brg clock source select bit, make sure the brg register value you set does not exceed 2 mbps. ? about successive transmission to transmit multiple data successively, set the next transmit data in the sio transmit buffer register before transmission of the preceding data is completed. ? about reception because during csio mode the receive shift clock is derived from operation of the transmit circuit, you need to execute transmit operation (by sending dummy data) even when you only want to receive data. in this case, note that if the port function is set for txd pin (by setting the operation mode register to 1), dummy data is actually output from the pin. ? about successive reception to receive multiple data successively, set data (dummy data) in the sio transmit buffer register before the transmitter starts sending data. ? transmit/receive operations using dma to transmit/receive data in dma request mode, enable the dmac to accept transfer requests (by setting the dma mode register) before you start serial communication. ? about the receive-finished bit if a receive error (overrun error) occurs, the receive-finished bit cannot be cleared by reading out the receive buffer register. in this case, it can only be cleared by clearing the receive enable bit.
12 12-44 ver.0.10 serial i/o 12.5 precautions on using csio mode ? about overrun error if all bits of the next receive data are received in the sio receive shift register before you read out the sio receive buffer register (an overrun error occurs), the receive data is not stored in the receive buffer register and the receive buffer register retains the previously received data. thereafter, although receive operation is continued, no receive data is stored in the receive buffer register (the receive status bit = 1). to restart reception normally, you need to temporarily clear the receive enable bit before you restart. this is the only way you can clear the overrun error flag. ? about dma transfer request generation during sio transmission if the transmit buffer register becomes empty (the transmit buffer empty flag = 1) while the transmit enable bit is set to 1 (transmit enabled), an sio transmit buffer empty dma transfer request is generated. ? about dma transfer request generation during sio reception when the receive-finished bit is set to 1 (the receive buffer register full), a receive-finished dma transfer request is generated. however, if an overrun error has occurred, this dma transfer request is not generated.
12 12-45 ver.0.10 serial i/o 12.6 transmit operation in uart mode 12.6 transmit operation in uart mode 12.6.1 setting the uart baud rate the baud rate (data transfer rate) during uart mode is determined by a transmit/receive shift clock. in uart mode, the source for this transmit/receive shift clock is always the internal clock regardless of how the internal/external clock select bit (sio transmit/receive mode register bit d11) is set. (1) calculating the uart mode baud rate after being divided by the clock divider, f(bclk) is fed into the baud rate generator (brg), after which it is further divided by 16 to produce a transmit/receive shift clock. the clock divider's divide-by value is selected from 1, 8, 32, or 256(note) using the sio transmit control register's cdiv (baud rate generator count source select) bits (d2, d3). the baud rate generator divides the clock it received from the clock divider by (baud rate register set value + 1) and further divides the resulting clock by 16 to produce a transmit/receive shift clock. during uart mode (in which the internal clock is always used), the baud rate is calculated using the equation below. 1 (bclk) baud rate = [bps] clock divider's divide-by value (baud rate register set value + 1) 16 baud rate register set value = h'00 to h'ff (note) clock divider's divide-by value = 1, 8, 32, or 256 note : if the divide-by value selected for the baud rate generator count source is "1" (i.e., f(bclk) itself), make sure the baud rate register value you set is equal to or greater than 7.
12 12-46 ver.0.10 serial i/o 12.6 transmit operation in uart mode 12.6.2 uart transmit/receive data formats the transmit/receive data format during uart mode is determined by setting the sio transmit/ receive mode register. shown below is the transmit/receive data format that can be used in uart mode. figure 12.6.1 example of transmit/receive data format in uart mode table 12.6.1 transfer data in uart mode bit name content st (start bit) indicates the beginning of data transmission. this is a low signal of a one bit duration, which is added immediately before the transmit data. d0-d8 (character bits) transmit/receive data transferred via serial i/o. in uart mode, data in 7, 8, or 9 bits can be transmitted/received. par (parity bit) added to the transmit/receive characters. when parity is enabled, parity is automatically set in such a way that the number of 1's in characters including the parity bit itself is always even or odd as selected by the even/odd parity select bit. sp (stop bit) indicates the end of data transmission, and is added immediately after characters (or if parity enabled, immediately after the parity bit). the stop bit can be chosen to be one bit or two bits long. st d7 d6 d5 d4 d3 d2 d1 d0 par sp sp lsb msb st parity bit stop bit start bit data bits (8 bits) transmit data next data
12 12-47 ver.0.10 figure 12.6.2 selectable data formats during uart mode note 1 : the high-order bits of the sio receive buffer register's selected character bits are fixed to 0. note 2 : the data bit numbers (dn) above indicate bit numbers in a data list, and not the register bit numbers (dn). serial i/o 12.6 transmit operation in uart mode 9-bit characters st d7 d6 d5 d4 d3 d2 d1 d0 par sp sp st d7 d6 d5 d4 d3 d2 d1 d0 par sp st d7 d6 d5 d4 d3 d2 d1 d0 sp sp st d7 d6 d5 d4 d3 d2 d1 d0 sp lsb msb d8 d8 d8 d8 start bit character (data) bits parity bit stop bit d0 d7 d8 d15 sio transmit buffer register sio receive buffer register st d7 d6 d5 d4 d3 d2 d1 d0 par sp sp st d7 d6 d5 d4 d3 d2 d1 d0 par sp st d7 d6 d5 d4 d3 d2 d1 d0 sp sp st d7 d6 d5 d4 d3 d2 d1 d0 sp lsb msb st d7 d6 d5 d4 d3 d2 d1 par sp sp st d7 d6 d5 d4 d3 d2 d1 par sp st d7 d6 d5 d4 d3 d2 d1 sp sp st d7 d6 d5 d4 d3 d2 d1 sp lsb msb 8-bit characters 7-bit characters st : d0 - d7 : par : sp : 9-bit characters 8-bit characters 7-bit characters
12 12-48 ver.0.10 serial i/o 12.6 transmit operation in uart mode 12.6.3 initial settings for uart transmission to transmit data in uart mode, initialize the serial i/o following the procedure described below. (1) setting sio transmit/receive mode register set the register to uart mode set parity (when enabled, select odd/even) set stop bit length set character length note : during uart mode, settings of the internal/external clock select bit have no effect (only the internal clock is useful). (2) setting sio transmit control register select the clock divider's divide-by ratio. (3) setting sio baud rate register set a baud rate generator value. (refer to section 12.6.1, "setting the uart baud rate.") (4) setting sio interrupt mask register enable or disable sio transmit interrupt. (5) setting the interrupt controller (sio transmit interrupt control register) when you use a transmit interrupt, set its priority level. (6) setting dmac when you issue dma transfer requests to the internal dmac when the transmit buffer is empty, set the dmac. (refer to chapter 9, "dmac.") (7) selecting pin functions because the serial i/o related pins serve dual purposes (shared with input/output ports), set pin functions. (refer to chapter 8, "input/output ports and pin functions.")
12 12-49 ver.0.10 figure 12.6.3 procedure for uart transmit initialization note : when you selected f(bclk) for the brg count source (cdvi), you are subject to limitations that the baud rate register value you set must be equal to or greater than 7. serial i/o 12.6 transmit operation in uart mode set sio transmit/receive mode register initial settings for uart transmission set register to uart mode set parity (when enabled, select odd/even) (when using dmac) set dmac related registers (when using interrupt) set the interrupt controller enable/disable transmit interrupt set sio interrupt related registers divide-by ratio h'00 to h'ff (note) set sio baud rate register select clock divider's divide-by ratio set sio transmit control register set input/output port operation mode register serial i/o related registers initial settings for uart transmission finished set stop bit length set character length
12 12-50 ver.0.10 serial i/o 12.6 transmit operation in uart mode 12.6.4 starting uart transmission when all of the following transmit conditions are met after you finished initialization, the serial i/o starts transmit operation. the sio transmit control register's ten (transmit enable) bit is set to 1. (note) transmit data is written to the sio transmit buffer register (transmit buffer empty bit = 0). note : while the transmit enable bit is cleared to 0, writes to the transmit buffer are ignored. always be sure to set the transmit enable bit to 1 before you write to the transmit buffer register. when transmission starts, the serial i/o transmits data following the procedure below. transfer the content of the sio transmit buffer register to the sio transmit shift register. set the transmit buffer empty bit to 1. (note) start sending data synchronously with the shift clock beginning with the lsb. note : a transmit buffer empty interrupt request and/or a dma transfer request can be generated when the transmit buffer is emptied. 12.6.5 successive uart transmission once data is transferred from the transmit buffer register to the transmit shift register, the next data can be written to the transmit buffer register even when transmission of the preceding data is not completed. when the next data is written to the transmit buffer before completion of the preceding data transmission, the preceding and the next data are successively transmitted. to see if data has been transferred from the transmit buffer register to the transmit shift register, check the sio transmit control register's transmit buffer empty flag.
12 12-51 ver.0.10 serial i/o 12.6 transmit operation in uart mode 12.6.6 processing at end of uart transmission when data transmission is completed, the following operation is automatically performed in hardware. (1) when not transmitting successively the transmit status bit is set to 0. (2) when transmitting successively when transmission of the last data in a consecutive data train is completed, the transmit status bit is set to 0. 12.6.7 transmit interrupt if a transmit buffer empty interrupt has been enabled by the sio interrupt mask register, a transmit buffer empty interrupt is generated at the time data is transferred from the transmit buffer register to the transmit shift register. also, a transmit buffer empty interrupt is generated when the ten (transmit enable) bit is set to 1 (enabled after being disabled) while a transmit buffer empty interrupt has been enabled. you must set the interrupt controller (icu) before you can use transmit interrupts. 12.6.8 transmit dma transfer request when data has been transferred from the transmit buffer register to the transmit shift register, a transmit dma transfer request for the corresponding sio channel is ouput to the dmac. this transfer request is also output when the ten (transmit enable) bit is set to 1 (enabled after being disabled). you must set the interrupt controller (icu) before you can transmit data using dma transfers.
12 12-52 ver.0.10 serial i/o 12.6 transmit operation in uart mode figure 12.6.4 transmit operation during uart mode (hardware processing) note : this applies when transmit interrupt has been enabled by sio interrupt mask register. the following processing is automatically executed in hardware transfer content of transmit buffer to transmit shift register set transmit buffer empty bit to 1 transmit data y (successive transmission) transmit conditions met? y n n clear transmit status bit to 0 transmit dma transfer request transmit interrupt request (note) uart transmit operation starts uart transmit operation completed transmit conditions met?
12 12-53 ver.0.10 serial i/o 12.6 transmit operation in uart mode figure 12.6.5 example of uart transmission (transmitted only once, with transmit interrupt used) note 1 : change of the interrupt controller "sio transmit interrupt control register" interrupt request bit note 2 : when transmit-finished interrupt is enabled (dma transfer can also be requested at the same timing) note 3 : the interrupt controller ivect register is read or "sio transmit interrupt control register" interrupt request bit cleared note 4 : transmit interrupt request is generated when transmission is enabled. note 5 : even after transmit data is written to the transmit buffer, a transmit interrupt request is generated when the data is transferred from the transmit buffer to the transmit shift register and the transmit buffer is thereby emptied. 12.6.9 typical uart transmit operation the following shows a typical transmit operation in csio mode. : processing by software : interrupt generation txd rxd set write to transmit buffer register transmit buffer empty bit transmit enable bit cleared transmit status bit st d7 d6 d0 par st st txd sio transmit interrupt (note 1) transmit interrupt (note 4) interrupt request accepted transferred from transmit buffer to transmit shift register (transmission starts) (note 2) (note 3) transmit interrupt (note 5) cleared
12 12-54 ver.0.10 serial i/o 12.6 transmit operation in uart mode figure 12.6.6 example of uart transmission (successive transmission, with transmit interrupt used) note 1 : change of the interrupt controller "sio transmit interrupt control register" interrupt request bit note 2 : when transmit buffer empty interrupt is enabled (dma transfer can also be requested at the same timing) note 3 : the interrupt controller ivect register is read or "sio transmit interrupt control register" interrupt request bit cleared note 4 : transmit interrupt request is generated when transmission is enabled. note 5 : even after transmit data is written to the transmit buffer, a transmit interrupt request is generated when the data is transferred from the transmit buffer to the transmit shift register and the transmit buffer is thereby emptied. : interrupt generation first data next data (note 2) (note 4) (note 2) upon transmit interrupt, next data is written (first data) (next data) (note 5) : processing by software txd rxd set transmit buffer empty bit transmit enable bit cleared transmit status bit d7 st d0 d7 sp d0 txd sio transmit interrupt (note 1) write to transmit buffer register write to transmit buffer register transferred from transmit buffer to transmit shift register (transmission starts) cleared when transmission of last data is completed sp st interrupt request accepted (note 3)
12 12-55 ver.0.10 serial i/o 12.7 receive operation in uart mode 12.7 receive operation in uart mode 12.7.1 initial settings for uart reception to receive data in uart mode, initialize the serial i/o following the procedure described below. (1) setting sio transmit/receive mode register set the register to uart mode set parity (when enabled, select odd/even) set stop bit length set character length note : during uart mode, settings of the internal/external clock select bit have no effect (only the internal clock is useful). (2) setting sio transmit control register select the clock divider's divide-by ratio. (3) setting sio baud rate register set a baud rate generator value. (refer to section 12.6.1, "setting the uart baud rate.") (4) setting sio interrupt related registers cause of receive interrupt select register select the cause of receive interrupt (receive finished/receive error) interrupt mask register enable/disable receive interrupts (5) setting the interrupt controller when you use interrupts during reception, set its priority level. (6) setting dmac when you issue dma transfer requests to the internal dmac when reception is completed, set the dmac. (refer to chapter 9, "dmac.") (7) selecting pin functions because the serial i/o related pins serve dual purposes (shared with input/output ports), set pin functions. (refer to chapter 8, "input/output ports and pin functions.")
12 12-56 ver.0.10 serial i/o 12.7 receive operation in uart mode figure 12.7.1 procedure for uart receive initialization note : when you selected the clock divider's divide-by ratio = 1, you are subject to limitations that the baud rate register value you set must be equal to or greater than 7. set sio transmit/receive mode register initial settings for uart reception set register to uart mode set parity (when enabled, select odd/even) (when using dmac) set dmac related registers (when using interrupt) set the interrupt controller sio receive interrupt control register set sio interrupt related registers divide-by ratio h'00 to h'ff (note) set sio baud rate register select clock divider's divide-by ratio set sio transmit control register set input/output port operation mode register serial i/o related registers initial settings for uart reception finished set stop bit length set character length cause of receive interrupt select register (receive finished/receive error) interrupt mask register (enable/disable receive interrupts)
12 12-57 ver.0.10 serial i/o 12.7 receive operation in uart mode 12.7.2 starting uart reception when all of the following receive conditions are met after you finished initialization, the serial i/o starts receive operation. the sio receive control register's receive enable bit is set to 1 start bit (falling edge signal) is applied to the rxd pin when the above conditions are met, the serial i/o enters uart receive operation. however, if the start bit when checked again at the first rise of the internal receive shift clock is detected high for reason of noise, etc., the serial i/o stops receive operation and waits for the start bit again. 12.7.3 processing at end of uart reception when data reception is completed, the following operation is automatically performed in hardware. (1) when reception is completed normally the receive-finished (receive buffer full) bit is set to 1. note 1 : if a receive-finished (receive buffer full) interrupt has been enabled, an interrupt request is generated. note 2 : a dma transfer request is generated. (2) when error occurs during reception when an error occurs during reception, the corresponding error bit (oe, fe, or pe) and the receive sum bit are set to 1. note 1 : if a receive-finished interrupt has been selected (by sio cause of receive interrupt select register), a receive-finished interrupt request is generated when interrupt requests are enabled. however, if an overrun error has occurred, this interrupt is not generated. note 2 : if a receive error interrupt has been selected (by sio cause of receive interrupt select register), a receive error interrupt request is generated when interrupt requests are enabled. note 3 : no dma transfer requests are generated.
12 12-58 ver.0.10 serial i/o 12.7 receive operation in uart mode figure 12.7.2 receive operation during uart mode (hardware processing) receive data y transfer data from sio receive shift register to sio receive buffer register set sio receive control register's receive-finished bit to 1 set receive status bit to 1 overrun error? parity error or framing error? start bit detected normally? set sio receive control register's overrun error bit and error sum bit to 1 set sio receive control register's corresponding error bit and receive error sum bit to 1 n uart reception completed the following processing is automatically executed in hardware transmit conditions met? y n uart receive operation starts y n n y
12 12-59 ver.0.10 serial i/o 12.7 receive operation in uart mode figure 12.7.3 example of uart reception (when received normally) note 1 : change of the interrupt controller "sio receive interrupt control register" interrupt request bit note 2 : when receive-finished interrupt is enabled (dma transfer can also be requested at the same timing) note 3 : the interrupt controller ivect register is read or "sio receive interrupt control register" interrupt request bit cleared 12.7.4 typical uart receive operation the following shows a typical receive operation in uart mode. sio receive interrupt (note 1) (when receive-finished interrupt is selected) automatically cleared for each receive operation performed receive-finished bit read from receive buffer (when receive error interrupt is selected) receive-finished interrupt (note 2) interrupt request accepted (note 3) no interrupt request internal clock selected rxd txd set receive enable bit (sio receive control register) cleared receive status bit : processing by software : interrupt generation st d7 d6 d0 par sp sp rxd
12 12-60 ver.0.10 serial i/o 12.7 receive operation in uart mode figure 12.7.4 example of uart reception (when overrun error occurred) note 1 : change of the interrupt controller "sio receive interrupt control register" interrupt request bit note 2 : when receive-finished interrupt is enabled note 3 : when receive error interrupt is enabled note 4 : this is done by clearing the receive enable bit to 0. note 5 : the interrupt controller ivect register is read or "sio receive interrupt control register" interrupt request bit cleared first data reception completed overrun error bit receive buffer not read during this interval overrun error bit cleared (note 4) receive error interrupt (note 3) rxd txd set st d7 sp st d7 sp rxd set sio receive interrupt (note 1) (when receive-finished interrupt is selected) (when receive error interrupt is selected) receive-finished interrupt (note 2) interrupt request accepted (note 5) interrupt request accepted (note 5) : processing by software : interrupt generation next data reception completed (note 5) receive enable bit (sio receive control register) receive-finished bit
12 12-61 ver.0.10 serial i/o 12.8 fixed period clock output function 12.8 fixed period clock output function when using sio0, sio1, sio4 or sio5 in uart mode, you can choose the relevant port (p84, p87, p65 or p66) to function as the sclko0, sclko1, sclko4 or sclko5 pin. in this way, a clock derived from brg output by dividing it by 2 can be output from the sclko pin. note : this clock is output all the time, not just during data transfer. figure 12.8.1 example of fixed period clock output sclko txd rxd clock output to peripheral circuits uart transmit/receive st sp data st sp data 50% 50% brg period internal brg output sclko output 1. configuration when using brg/2 clock 2. operation timing
12 12-62 ver.0.10 serial i/o 12.9 precautions on using uart mode 12.9 precautions on using uart mode settings of sio transmit/receive mode register and sio baud rate register the sio transmit/receive mode register and sio baud rate register and the transmit control register's brg count source select bit must always be set when not operating. when transmitting or receiving data, be sure to check that transmission and/or reception under way has been completed and clear the transmit and receive enable bits before you set the registers. settings of baud rate (brg) register if you selected f(bclk) with the brg clock source select bit, make sure the brg register value you set is equal to or greater than 7. the value written to the sio baud rate register becomes effective beginning with the next period after the brg counter finished counting. however, when transmit and receive operations are disabled, the register value can be changed at the same time you write to the register. transmit/receive operations using dma to transmit/receive data in dma request mode, enable the dmac to accept transfer requests (by setting the dma mode register) before you start serial communication. about overrun error if all bits of the next receive data are received in the sio receive shift register before you read out the sio receive buffer register (an overrun error occurs), the receive data is not stored in the receive buffer register and the receive buffer register retains the previously received data. once an overrun error occurs, no receive data is stored in the receive buffer register although receive operation is continued. to restart reception normally, you need to temporarily clear the receive enable bit before you restart. this is the only way you can clear the overrun error flag.
12 12-63 ver.0.10 serial i/o 12.9 precautions on using uart mode flags indicating the status of uart receive operation following flags are available that indicate the status of receive operation during uart mode. sio receive control register receive status bit sio receive control register receive-finished bit sio receive control register receive error sum bit sio receive control register overrun error bit sio receive control register parity error bit sio receive control register framing error bit the manner in which the receive-finished bit and various error bit flags are cleared varies depending on whether an overrun error has occurred or not, as described below. [when no overrun error has occurred] said bits can be cleared by reading the lower byte from the receive buffer register or clearing the receive enable bit to 0. [when an overrun error has occurred] said bits can only be cleared by clearing the receive enable bit to 0.
12 12-64 ver.0.10 * this is a blank page.* serial i/o 12.9 precautions on using uart mode
chapter 13 chapter 13 can module 13.1 outline of the can module 13.2 can module related registers 13.3 can protocol 13.4 initializing the can module 13.5 transmitting data frames 13.6 receiving data frames 13.7 transmitting remote frames 13.8 receiving remote frames
13 13-2 ver.0.10 can module 13.1 outline of the can module 13.1 outline of the can module the m32r/e contains can (controller area network) specification 2.0b-compliant full can module. this module has 16 message slots and three mask registers, effective use of which helps to reduce the cpu load for data processing. the following outlines the full can module. table 13.1.1 outline of the can module item content protocol can specification 2.0b number of message slots total 16 slots (14 global slots, two local slots) polarity 0: dominant 1: recessive acceptance filter one global mask two local masks baud rate 1 time quantum (tq) = (brp + 1)/cpu clock (brp: baud rate prescaler set value) brp :1-255 (0: inhibited) number of tq's for one bit = synchronization segment + propagation segment + phase segment 1 + phase segment 2 + progagation segment : 1-8tq phase segment 1 : 1-8tq phase segment 2 : 2-8tq (ipt = 2) remote frame automatic a slot which received a remote frame automatically sends a data frame. response function time stamp function time stamp function implemented by a 16-bit counter. using can bus bit period as the fundamental period, a count period can be set to 1/1 through 1/4 of it. basiccan mode basiccan function is materialized using two local slots. transmit abort function transmit request can be canceled. loopback function the data transmitted by can module itself is received. return bus off function forcibly placed into error active mode after clearing error counter. baud rate = 1 tq period x number of tq's for one bit max 1 mibps
13 13-3 ver.0.10 table 13.1.2 can module interrupt generation function can module interrupt source icu interrupt source can0 transmit complete interrupt can0 group interrupt can0 receive complete interrupt can0 group interrupt can0 bus error interrupt can0 group interrupt can0 error passive interrupt can0 group interrupt can0 bus off interrupt can0 group interrupt can module 13.1 outline of the can module figure 13.1.1 block diagram of the can module ctx crx data bus can0 status register can0 rec register can0 tec register can0 message slot 0-15 control register can0 extended id register can0 configuration register can0 control register can0 global mask register can0 local mask register a can0 local mask register b message memory (1) message id (2) data length code (3) message data (4) time stamp can0 slot status register can0 slot interrupt control register can0 error interrupt control register interrupt control circuit can0 interrupt acceptance filtering 16-bit timer can0 time stamp register can0 protocol controller ver 2.0b
13 13-4 ver.0.10 13.2 can module related registers the diagram below shows a can module related register map. can module 13.2 can module related registers figure 13.2.1 can module related register map (1/4) +0 address +1 address d0 d7 d8 d15 h'0080 1034 h'0080 1032 h'0080 1038 h'0080 1036 h'0080 103c h'0080 103a h'0080 1054 address h'0080 1058 h'0080 1056 h'0080 1052 h'0080 105a can0 configuration register (can0conf) can0 global mask register standard id0 (c0gmsks0) can0 local mask register a standard id0 (c0lmskas0) h'0080 1000 h'0080 1002 h'0080 1004 h'0080 1008 h'0080 100a h'0080 1010 h'0080 100e h'0080 1006 h'0080 1028 h'0080 102c h'0080 1030 h'0080 102e h'0080 102a h'0080 105c h'0080 100c h'0080 1050 can0 control register (can0cnt) can0 extended id register (can0extid) can0 time stamp count register (can0tstmp) can0 slot interrupt status register (can0slst) can0 status register (can0stat) can0 receive error count register (can0rec) can0 transmit error count register (can0tec) can0 message slot 0 control register (c0msl0cnt) h'0080 1012 can0 error interrupt status register (can0erist) can0 error interrupt mask register (can0erimk) h'0080 1014 h'0080 1016 can0 baud rate prescaler (can0brp) h'0080 105e can0 global mask register extended id0 (c0gmske0) can0 local mask register a extended id0 (c0lmskae0) blank addresses are reserved. can0 slot interrupt mask register (can0slimk) can0 global mask register standard id1 (c0gmsks1) can0 global mask register extended id1 (c0gmske1) can0 global mask register extended id2 (c0gmske2) can0 local mask register a standard id1 (c0lmskas1) can0 local mask register a extended id1 (c0lmskae1) can0 local mask register a extended id2 (c0lmskae2) can0 local mask register b standard id0 (c0lmskas0) can0 local mask register b extended id0 (c0lmskae0) can0 local mask register b standard id1 (c0lmskas1) can0 local mask register b extended id1 (c0lmskae1) can0 local mask register b extended id2 (c0lmskae2) can0 message slot 1 control register (c0msl1cnt) can0 message slot 2 control register (c0msl2cnt) can0 message slot 3 control register (c0msl3cnt) can0 message slot 4 control register (c0msl4cnt) can0 message slot 5 control register (c0msl5cnt) can0 message slot 6 control register (c0msl6cnt) can0 message slot 7 control register (c0msl7cnt) can0 message slot 8 control register (c0msl8cnt) can0 message slot 9 control register (c0msl9cnt) can0 message slot 10 control register (c0msl10cnt) can0 message slot 11 control register (c0msl11cnt) can0 message slot 12 control register (c0msl12cnt) can0 message slot 13 control register (c0msl13cnt) can0 message slot 14 control register (c0msl14cnt) can0 message slot 15 control register (c0msl15cnt) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
13 13-5 ver.0.10 figure 13.2.2 can module related register map (2/4) can module 13.2 can module related registers d0 d7 d8 d15 h'0080 1102 h'0080 1104 h'0080 110c h'0080 110e h'0080 1112 h'0080 1114 h'0080 1116 h'0080 1110 h'0080 1108 h'0080 1106 h'0080 110a can0 message slot 0 extended id0 (c0msl0eid0) can0 message slot 0 data 0 (c0msl0dt0) can0 message slot 0 data length register (c0msl0dlc) can0 message slot 0 time stamp (c0msl0tsp) h'0080 1118 h'0080 111a h'0080 111e h'0080 1120 h'0080 1122 h'0080 1126 h'0080 1128 h'0080 112e h'0080 112c h'0080 1124 h'0080 112a h'0080 111c h'0080 1130 h'0080 1132 h'0080 1136 h'0080 1138 h'0080 113e h'0080 113c h'0080 1134 h'0080 113a h'0080 1140 h'0080 1142 h'0080 1146 h'0080 1148 h'0080 114e h'0080 114c h'0080 1144 h'0080 114a h'0080 1150 h'0080 1152 h'0080 1100 can0 message slot 0 standard id0 (c0msl0sid0) +0 address +1 address address blank addresses are reserved. can0 message slot 0 standard id1 (c0msl0sid1) can0 message slot 0 extended id2 (c0msl0eid2) can0 message slot 0 extended id1 (c0msl0eid1) can0 message slot 0 data 1 (c0msl0dt1) can0 message slot 0 data 2 (c0msl0dt2) can0 message slot 0 data 3 (c0msl0dt3) can0 message slot 0 data 4 (c0msl0dt4) can0 message slot 0 data 5 (c0msl0dt5) can0 message slot 0 data 6 (c0msl0dt6) can0 message slot 0 data 7 (c0msl0dt7) can0 message slot 1 extended id0 (c0msl1eid0) can0 message slot 1 data 0 (c0msl1dt0) can0 message slot 1 data length register (c0msl1dlc) can0 message slot 1 time stamp (c0msl1tsp) can0 message slot 1 standard id0 (c0msl1sid0) can0 message slot 1 standard id1 (c0msl1sid1) can0 message slot 1 extended id2 (c0msl1eid2) can0 message slot 1 extended id1 (c0msl1eid1) can0 message slot 1 data 1 (c0msl1dt1) can0 message slot 1 data 2 (c0msl1dt2) can0 message slot 1 data 3 (c0msl1dt3) can0 message slot 1 data 4 (c0msl1dt4) can0 message slot 1 data 5 (c0msl1dt5) can0 message slot 1 data 6 (c0msl1dt6) can0 message slot 1 data 7 (c0msl1dt7) can0 message slot 2 extended id0 (c0msl2eid0) can0 message slot 2 data 0 (c0msl2dt0) can0 message slot 2 data length register (c0msl2dlc) can0 message slot 2 time stamp (c0msl2tsp) can0 message slot 2 standard id0 (c0msl2sid0) can0 message slot 2 standard id1 (c0msl2sid1) can0 message slot 2 extended id2 (c0msl2eid2) can0 message slot 2 extended id1 (c0msl2eid1) can0 message slot 2 data 1 (c0msl2dt1) can0 message slot 2 data 2 (c0msl2dt2) can0 message slot 2 data 3 (c0msl2dt3) can0 message slot 2 data 4 (c0msl2dt4) can0 message slot 2 data 5 (c0msl2dt5) can0 message slot 2 data 6 (c0msl2dt6) can0 message slot 2 data 7 (c0msl2dt7) can0 message slot 3 extended id0 (c0msl3eid0) can0 message slot 3 data 0 (c0msl3dt0) can0 message slot 3 data length register (c0msl3dlc) can0 message slot 3 time stamp (c0msl3tsp) can0 message slot 3 standard id0 (c0msl3sid0) can0 message slot 3 standard id1 (c0msl3sid1) can0 message slot 3 extended id2 (c0msl3eid2) can0 message slot 3 extended id1 (c0msl3eid1) can0 message slot 3 data 1 (c0msl3dt1) can0 message slot 3 data 2 (c0msl3dt2) can0 message slot 3 data 3 (c0msl3dt3) can0 message slot 3 data 4 (c0msl3dt4) can0 message slot 3 data 5 (c0msl3dt5) can0 message slot 3 data 6 (c0msl3dt6) can0 message slot 3 data 7 (c0msl3dt7) can0 message slot 4 extended id0 (c0msl4eid0) can0 message slot 4 data 0 (c0msl4dt0) can0 message slot 4 data length register (c0msl4dlc) can0 message slot 4 time stamp (c0msl4tsp) can0 message slot 4 standard id0 (c0msl4sid0) can0 message slot 4 standard id1 (c0msl4sid1) can0 message slot 4 extended id2 (c0msl4eid2) can0 message slot 4 extended id1 (c0msl4eid1) can0 message slot 4 data 1 (c0msl4dt1) can0 message slot 4 data 2 (c0msl4dt2) can0 message slot 4 data 3 (c0msl4dt3) can0 message slot 4 data 4 (c0msl4dt4) can0 message slot 4 data 5 (c0msl4dt5) can0 message slot 4 data 6 (c0msl4dt6) can0 message slot 4 data 7 (c0msl4dt7) can0 message slot 5 extended id0 (c0msl5eid0) can0 message slot 5 standard id0 (c0msl5sid0) can0 message slot 5 standard id1 (c0msl5sid1) can0 message slot 5 extended id1 (c0msl5eid1)
13 13-6 ver.0.10 figure 13.2.3 can module related register map (3/4) can module 13.2 can module related registers d0 d7 d8 d15 h'0080 1156 h'0080 1158 h'0080 115e h'0080 115c h'0080 1154 h'0080 115a h'0080 1160 h'0080 1162 h'0080 1166 h'0080 1168 h'0080 116e h'0080 116c h'0080 1164 h'0080 116a h'0080 1170 h'0080 1172 h'0080 1176 h'0080 1174 h'0080 117a h'0080 117c h'0080 117e h'0080 1182 h'0080 1184 h'0080 118a h'0080 1188 h'0080 1180 h'0080 1186 h'0080 1178 h'0080 118c h'0080 118e h'0080 1192 h'0080 1194 h'0080 119a h'0080 1198 h'0080 1190 h'0080 1196 h'0080 119c h'0080 119e h'0080 11a2 h'0080 11a4 h'0080 11a0 h'0080 11a6 +0 address +1 address address can0 message slot 6 extended id0 (c0msl6eid0) can0 message slot 6 data 0 (c0msl6dt0) can0 message slot 6 data length register (c0msl6dlc) can0 message slot 6 time stamp (c0msl6tsp) can0 message slot 6 standard id0 (c0msl6sid0) can0 message slot 6 standard id1 (c0msl6sid1) can0 message slot 6 extended id2 (c0msl6eid2) can0 message slot 6 extended id1 (c0msl6eid1) can0 message slot 6 data 1 (c0msl6dt1) can0 message slot 6 data 2 (c0msl6dt2) can0 message slot 6 data 3 (c0msl6dt3) can0 message slot 6 data 4 (c0msl6dt4) can0 message slot 6 data 5 (c0msl6dt5) can0 message slot 6 data 6 (c0msl6dt6) can0 message slot 6 data 7 (c0msl6dt7) blank addresses are reserved. can0 message slot 5 data 0 (c0msl5dt0) can0 message slot 5 data length register (c0msl5dlc) can0 message slot 5 time stamp (c0msl5tsp) can0 message slot 5 extended id2 (c0msl5eid2) can0 message slot 5 data 1 (c0msl5dt1) can0 message slot 5 data 2 (c0msl5dt2) can0 message slot 5 data 3 (c0msl5dt3) can0 message slot 5 data 4 (c0msl5dt4) can0 message slot 5 data 5 (c0msl5dt5) can0 message slot 5 data 6 (c0msl5dt6) can0 message slot 5 data 7 (c0msl5dt7) can0 message slot 7 extended id0 (c0msl7eid0) can0 message slot 7 data 0 (c0msl7dt0) can0 message slot 7 data length register (c0msl7dlc) can0 message slot 7 time stamp (c0msl7tsp) can0 message slot 7 standard id0 (c0msl7sid0) can0 message slot 7 standard id1 (c0msl7sid1) can0 message slot 7 extended id2 (c0msl7eid2) can0 message slot 7 extended id1 (c0msl7eid1) can0 message slot 7 data 1 (c0msl7dt1) can0 message slot 7 data 2 (c0msl7dt2) can0 message slot 7 data 3 (c0msl7dt3) can0 message slot 7 data 4 (c0msl7dt4) can0 message slot 7 data 5 (c0msl7dt5) can0 message slot 7 data 6 (c0msl7dt6) can0 message slot 7 data 7 (c0msl7dt7) can0 message slot 8 extended id0 (c0msl8eid0) can0 message slot 8 data 0 (c0msl8dt0) can0 message slot 8 data length register (c0msl8dlc) can0 message slot 8 time stamp (c0msl8tsp) can0 message slot 8 standard id0 (c0msl8sid0) can0 message slot 8 standard id1 (c0msl8sid1) can0 message slot 8 extended id2 (c0msl8eid2) can0 message slot 8 extended id1 (c0msl8eid1) can0 message slot 8 data 1 (c0msl8dt1) can0 message slot 8 data 2 (c0msl8dt2) can0 message slot 8 data 3 (c0msl8dt3) can0 message slot 8 data 4 (c0msl8dt4) can0 message slot 8 data 5 (c0msl8dt5) can0 message slot 8 data 6 (c0msl8dt6) can0 message slot 8 data 7 (c0msl8dt7) can0 message slot 9 extended id0 (c0msl9eid0) can0 message slot 9 data 0 (c0msl9dt0) can0 message slot 9 data length register (c0msl9dlc) can0 message slot 9 time stamp (c0msl9tsp) can0 message slot 9 standard id0 (c0msl9sid0) can0 message slot 9 standard id1 (c0msl9sid1) can0 message slot 9 extended id2 (c0msl9eid2) can0 message slot 9 extended id1 (c0msl9eid1) can0 message slot 9 data 1 (c0msl9dt1) can0 message slot 9 data 2 (c0msl9dt2) can0 message slot 9 data 3 (c0msl9dt3) can0 message slot 9 data 4 (c0msl9dt4) can0 message slot 9 data 5 (c0msl9dt5) can0 message slot 9 data 6 (c0msl9dt6) can0 message slot 9 data 7 (c0msl9dt7) can0 message slot 10 extended id0 (c0msl10eid0) can0 message slot 10 data 0 (c0msl10dt0) can0 message slot 10 data length register (c0msl10dlc) can0 message slot 10 standard id0 (c0msl10sid0) can0 message slot 10 standard id1 (c0msl10sid1) can0 message slot 10 extended id2 (c0msl10eid2) can0 message slot 10 extended id1 (c0msl10eid1) can0 message slot 10 data 1 (c0msl10dt1)
13 13-7 ver.0.10 figure 13.2.4 can module related register map (4/4) can module 13.2 can module related registers h'0080 11aa h'0080 11a8 h'0080 11ac h'0080 11ae h'0080 11b2 h'0080 11bc h'0080 11ba h'0080 11b8 h'0080 11b0 h'0080 11b6 h'0080 11be h'0080 11c2 h'0080 11c4 h'0080 11ca h'0080 11c8 h'0080 11c0 h'0080 11c6 h'0080 11ce h'0080 11d2 h'0080 11d0 h'0080 11d6 h'0080 11d8 h'0080 11da h'0080 11de h'0080 11e0 h'0080 11e6 h'0080 11e4 h'0080 11dc h'0080 11e2 h'0080 11d4 h'0080 11e8 h'0080 11ea h'0080 11ee h'0080 11f0 h'0080 11f6 h'0080 11f4 h'0080 11ec h'0080 11f2 h'0080 11f8 h'0080 11fa h'0080 11fe h'0080 3ffe h'0080 11fc h'0080 11cc h'0080 11b4 can0 message slot 11 extended id0 (c0msl11eid0) can0 message slot 11 data 0 (c0msl11dt0) can0 message slot 11 data length register (c0msl11dlc) can0 message slot 11 time stamp (c0msl11tsp) can0 message slot 11 standard id0 (c0msl11sid0) can0 message slot 11 standard id1 (c0msl11sid1) can0 message slot 11 extended id2 (c0msl11eid2) can0 message slot 11 extended id1 (c0msl11eid1) can0 message slot 11 data 1 (c0msl11dt1) can0 message slot 11 data 2 (c0msl11dt2) can0 message slot 11 data 3 (c0msl11dt3) can0 message slot 11 data 4 (c0msl11dt4) can0 message slot 11 data 5 (c0msl11dt5) can0 message slot 11 data 6 (c0msl11dt6) can0 message slot 11 data 7 (c0msl11dt7) d0 d7 d8 d15 +0 address +1 address address blank addresses are reserved. can0 message slot 10 time stamp (c0msl10tsp) can0 message slot 10 data 2 (c0msl10dt2) can0 message slot 10 data 3 (c0msl10dt3) can0 message slot 10 data 4 (c0msl10dt4) can0 message slot 10 data 5 (c0msl10dt5) can0 message slot 10 data 6 (c0msl10dt6) can0 message slot 10 data 7 (c0msl10dt7) can0 message slot 12 extended id0 (c0msl12eid0) can0 message slot 12 data 0 (c0msl12dt0) can0 message slot 12 data length register (c0msl12dlc) can0 message slot 12 time stamp (c0msl12tsp) can0 message slot 12 standard id0 (c0msl12sid0) can0 message slot 12 standard id1 (c0msl12sid1) can0 message slot 12 extended id2 (c0msl12eid2) can0 message slot 12 extended id1 (c0msl12eid1) can0 message slot 12 data 1 (c0msl12dt1) can0 message slot 12 data 2 (c0msl12dt2) can0 message slot 12 data 3 (c0msl12dt3) can0 message slot 12 data 4 (c0msl12dt4) can0 message slot 12 data 5 (c0msl12dt5) can0 message slot 12 data 6 (c0msl12dt6) can0 message slot 12 data 7 (c0msl12dt7) can0 message slot 13 extended id0 (c0msl13eid0) can0 message slot 13 data 0 (c0msl13dt0) can0 message slot 13 data length register (c0msl13dlc) can0 message slot 13 time stamp (c0msl13tsp) can0 message slot 13 standard id0 (c0msl13sid0) can0 message slot 13 standard id1 (c0msl13sid1) can0 message slot 13 extended id2 (c0msl13eid2) can0 message slot 13 extended id1 (c0msl13eid1) can0 message slot 13 data 1 (c0msl13dt1) can0 message slot 13 data 2 (c0msl13dt2) can0 message slot 13 data 3 (c0msl13dt3) can0 message slot 13 data 4 (c0msl13dt4) can0 message slot 13 data 5 (c0msl13dt5) can0 message slot 13 data 6 (c0msl13dt6) can0 message slot 13 data 7 (c0msl13dt7) can0 message slot 14 extended id0 (c0msl14eid0) can0 message slot 14 data 0 (c0msl14dt0) can0 message slot 14 data length register (c0msl14dlc) can0 message slot 14 standard id0 (c0msl14sid0) can0 message slot 14 standard id1 (c0msl14sid1) can0 message slot 14 extended id2 (c0msl14eid2) can0 message slot 14 extended id1 (c0msl14eid1) can0 message slot 14 data 1 (c0msl14dt1) can0 message slot 14 data 2 (c0msl14dt2) can0 message slot 14 data 3 (c0msl14dt3) can0 message slot 14 data 4 (c0msl14dt4) can0 message slot 14 data 5 (c0msl14dt5) can0 message slot 14 data 6 (c0msl14dt6) can0 message slot 14 data 7 (c0msl14dt7) can0 message slot 14 time stamp (c0msl14tsp) can0 message slot 15 extended id0 (c0msl15eid0) can0 message slot 15 data 0 (c0msl15dt0) can0 message slot 15 data length register (c0msl15dlc) can0 message slot 15 standard id0 (c0msl15sid0) can0 message slot 15 standard id1 (c0msl15sid1) can0 message slot 15 extended id2 (c0msl15eid2) can0 message slot 15 extended id1 (c0msl15eid1) can0 message slot 15 data 1 (c0msl15dt1) can0 message slot 15 data 2 (c0msl15dt2) can0 message slot 15 data 3 (c0msl15dt3) can0 message slot 15 data 4 (c0msl15dt4) can0 message slot 15 data 5 (c0msl15dt5) can0 message slot 15 data 6 (c0msl15dt6) can0 message slot 15 data 7 (c0msl15dt7) can0 message slot 15 time stamp (c0msl15tsp) ~ ~ ~ ~
13 13-8 ver.0.10 w = : only writing a 1 is effective. automatically cleared to 0 in hardware. 13.2.1 can control register n can0 control register (can0cnt) can module 13.2 can module related registers d bit name function r w 0-3 no functions assigned 0 C 4 rbo 0: enables normal operation (return bus off) 1: requests clearing of error counter 5 tsr 0: enables count operation (time stamp counter reset) 1: initializes count (by setting h'0000) 6-7 tsp d6 d7 (time stamp prescaler) 0 0 : selects can bus bit clock 0 1 : selects can bus bit clock divided by 2 1 0 : selects can bus bit clock divided by 3 1 1 : selects can bus bit clock divided by 4 8-9 no functions assigned 0 C 10 no functions assigned (always write a 0.) 0 C 11 frst 0: negates rest (forcible reset) 1: forcibly resets 12 bcm 0: disables basiccan function (basiccan mode) 1: basiccan mode 13 no functions assigned 0 C 14 lbm 0: disables loopback function (loopback mode) 1: enables loopback function 15 rst 0: negates reset (can reset) 1: requests reset d01234567891011121314d15 rbo tsr tsp frst bcm lbm rst
13 13-9 ver.0.10 can module 13.2 can module related registers (1) rbo (return bus off) bit (d4) setting this bit to 1 clears the receive error counter (can0rec) and transmit error counter (can0tec) and forcibly places the can module into an error active state. this bit is cleared when an error active state is entered. note: after clearing the error counter, transmission becomes possible when 11 consecutive recessive bits are detected on the can bus. (2) tsr (time stamp counter reset) bit (d5) setting this bit to 1 clears the value of the can time stamp counter register (can0tstmp) to h'0000. this bit is cleared when the value of the can time stamp counter register (can0tstmp) is cleared to h'0000. (3) tsp (time stamp prescaler) bits (d6, d7) these bits select the count clock source for the time stamp counter. note: do not change settings of tsp bits while can is operating (can status register crs bit = 0). (4) frst (forcible reset) bit (d11) when the frst bit is set to 1, the can module is separated from the can bus regardless of whether or not the can module is communicating and the protocol control unit is reset. note 1: to restart can communication, the frst and rst bits must be cleared to 0. note 2: if the frst bit is set to 1 during communication, the ctx pin output goes high immediately after that. therefore, setting the frst bit to 1 while transmitting can frame may cause a can bus error. (5) bcm (basiccan mode) bit (d12) by setting this bit to 1, the can module can be operated in basiccan mode. ? operation during basiccan mode in basiccan mode, two local slots-slots 14 and 15-are used as double buffers, and receive frames that are found matching to the id by acceptance filtering are stored alternately in slots 14 and 15. used for this acceptance filtering when slot 14 is active (next receive frame to be stored in slot 14) are the id set for slot 14 and local mask a, and those used when slot 15 is active are the id set for slot 15 and local mask b. two types of frames-data frame and remote frame-can be received in this mode.
13 13-10 ver.0.10 by using the same id and setting the same value in mask registers for the two slots, the possibility of a message-lost trouble when, for example, receiving frames which have many ids can be reduced. ? procedure for entering basiccan mode follow the procedure below during initialization: set the ids for slots 14 and 15 and local mask registers a and b. (we recommend setting the same value.) set the frame types handled by slots 14 and 15 (standard or extended) in the can extended id register. (we recommend setting the same type.) a set the message slot control register for slots 14 and 15 to for data frame reception. ? set the bcm bit to 1. note 1: do not change settings of bcm bit when can is operating (can status register crs bit = 0). note 2: the first slot that is active after clearing the rst bit is slot 14. note 3: even during basiccan mode, slots 0 to 13 can be used as in normal operation. (6) lbm (loopback mode) bit (d14) when the lbm bit is set to 1, if a receive slot exists whose id matches that of the frame sent by the can module itself, then the frame can be received. note 1: no ack is returned for the transmit frame. note 2: do not change settings of lbm bit when can is operating (can status register crs bit = 0). (7) rst (can reset) bit (d15) when the rst bit is cleared to 0, the can module is connected to the can bus and becomes possible to communicate after detecting 11 consecutive recessive bits. also, the can time stamp count register thereby starts counting. when the rst bit is set to 1, the can module is reset so that after sending a frame from the slot which has had a transmit request set, the protocol control unit is reset and the can module is disconnected from the can bus. frames received during this time are processed normally. note 1: it is inhibited to set a new transmit request for a while from when the can status register crs bit is set to 1 after setting the rst bit to 1 till when the protocol control unit is reset. note 2: when the protocol control unit is reset by setting the rst bit to 1, the can time stamp count register and can transmit/receive error count registers are initialized to 0. note 3: to restart can communication, the frst and rst bits must be cleared to 0. can module 13.2 can module related registers
13 13-11 ver.0.10 13.2.2 can status register n can0 status register (can0stat) d bit name function r w 0 no functions assigned 0 C 1 bos 0: not bus off C (bus off status) 1: bus off state 2 eps 0: not error passive C (error passive status) 1: error passive state 3 cbs 0: no error occurred C (can bus error) 1: error occurred 4 bcs 0: normal mode C (basiccan status) 1: basiccan mode 5 no functions assigned 0 C 6 lbs 0: normal mode C (loopback status) 1: loopback mode 7 crs 0: operating C (can reset status) 1: reset 8 rsb 0: not receiving C (receive status) 1: receiving 9 tsb 0: not transmitting C (transmit status) 1: transmitting 10 rsc 0: reception not completed yet C (receive complete status) 1: reception completed 11 tsc 0: transmission not completed yet C (transmit complete status) 1: transmission completed d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 bos eps cbs bcs 0 lbs crs rsb tsb rsc tsc msn can module 13.2 can module related registers
13 13-12 ver.0.10 (1) bos (bus off status) bit (d1) when bos bit = 1, it means that the can module is in a bus-off state. [set condition] this bit is set to 1 when the transmit error counter value exceeded 255 and a bus-off state is entered. [clear condition] this bit is cleared when restored from the bus-off state. (2) eps (error passive status) bit (d2) when eps bit = 1, it means that the can module is in an error passive state. [set condition] this bit is set to 1 when the transmit or receive error counter value exceeded 127 and an error passive state is entered. [clear condition] this bit is cleared when restored from the error passive state. d bit name function r w 12-15 msn number of message slot which has finished sending or receiving (message slot number) 0000 : slot0 C 0001 : slot1 0010 : slot2 0011 : slot3 0100 : slot4 0101 : slot5 0110 : slot6 0111 : slot7 1000 : slot8 1001 : slot9 1010 : slot10 1011 : slot11 1100 : slot12 1101 : slot13 1110 : slot14 1111 : slot15 can module 13.2 can module related registers
13 13-13 ver.0.10 (3) cbs (can bus error) bit (d3) [set condition] this bit is set to 1 when an error on the can bus is detected. [clear condition] this bit is cleared when normally transmitted or received. (4) bcs (basiccan status) bit (d4) when bcs bit = 1, it means that the can module is operating in basiccan mode. [set condition] this bit is set to 1 when operating in basiccan mode. conditions for operating in basiccan mode ? the can control register bcm bit must be set to 1. ? slots 14 and 15 both must be set for data frame reception. [clear condition] this bit is cleared by clearing the bcm bit to 0. (5) lbs (loopback status) bit (d6) when lbs bit = 1, it means that the can module is operating in loopback mode. [set condition] this bit is set to 1 by setting the can control register lbm (loopback mode) bit to 1. [clear condition] this bit is cleared by clearing the lbm bit to 0. (6) crs (can reset status) bit (d7) when crs bit = 1, it means that the protocol control unit is in a reset state. [set condition] this bit is set to 1 when the can module's protocol control unit is in a reset state. [clear condition] this bit is cleared by clearing the can control register rst (can reset) bit to 0. can module 13.2 can module related registers
13 13-14 ver.0.10 (7) rsb (receive status) bit (d8) [set condition] this bit is set to 1 when the can module is operating as a receive node. [clear condition] this bit is cleared when the can module started operating as a transmit node or entered a bus idle state. (8) tsb (transmit status) bit (d9) [set condition] this bit is set to 1 when the can module is operating as a transmit node. [clear condition] this bit is cleared when the can module started operating as a receive node or entered a bus idle state. (9) rsc (receive complete status) bit (d10) [set condition] this bit is set to 1 when the can module finished receiving normally (regardless of whether any slot exists that meets receive conditions). [clear condition] this bit is cleared when the can module finished transmitting normally. (10) tsc (transmit complete status) bit (d11) [set condition] this bit is set to 1 when the can module finished transmitting normally. [clear condition] this bit is cleared when the can module finished receiving normally. (11) msn (message slot number) bits (d12-d15) these bits show the relevant slot number when the can module finished transmitting or finished storing received data. this bit cannot be cleared to 0 in software. can module 13.2 can module related registers
13 13-15 ver.0.10 13.2.3 can extended id register n can0 extended id register (can0extid) this register selects the format of frames handled in message slots corresponding to each bit. the standard id format is selected when a message slot's corresponding bit is set to 0, or the extended id format is selected when the bit is set to 1. note: settings of each bit of this register can only be changed when the corresponding slot does not have transmit or receive requests set. d bit name function r w 0 ide0 (extended id0) 0: standard id format 1 ide1 (extended id1) 1: extended id format 2 ide2 (extended id2) 3 ide3 (extended id3) 4 ide4 (extended id4) 5 ide5 (extended id5) 6 ide6 (extended id6) 7 ide7 (extended id7) 8 ide8 (extended id8) 9 ide9 (extended id9) 10 ide10 (extended id10) 11 ide11 (extended id11) 12 ide12 (extended id12) 13 ide13 (extended id13) 14 ide14 (extended id14) 15 ide15 (extended id15) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 ide0 ide1 ide2 ide3 ide4 ide5 ide6 ide7 ide8 ide9 ide10 ide11 ide12 ide13 ide14 ide15 can module 13.2 can module related registers
13 13-16 ver.0.10 13.2.4 can configuration register n can0 configuration register (can0conf) d bit name function r w 0-1 sjw sets resynchronization jump width (resynchronization jump width) 00: sjw = 1tq 01: sjw = 2tq 10: sjw = 3tq 11: sjw = 4tq 2-4 ph2 sets phase segment2 (phase segment2) 000: settings inhibited 001: phase segment2 = 2tq 010: phase segment2 = 3tq 011: phase segment2 = 4tq 100: phase segment2 = 5tq 101: phase segment2 = 6tq 110: phase segment2 = 7tq 111: phase segment2 = 8tq 5-7 ph1 sets phase segment1 (phase segment1) 000: phase segment1 = 1tq 001: phase segment1 = 2tq 010: phase segment1 = 3tq 011: phase segment1 = 4tq 100: phase segment1 = 5tq 101: phase segment1 = 6tq 110: phase segment1 = 7tq 111: phase segment1 = 8tq d01234567891011121314d15 sjw ph2 ph1 prb sam can module 13.2 can module related registers
13 13-17 ver.0.10 d bit name function r w 8-10 prb sets propagation segment (propagation segment) 000: propagation seqment =1tq 001: propagation seqment = 2tq 010: propagation seqment = 3tq 011: propagation seqment = 4tq 100: propagation seqment = 5tq 101: propagation seqment = 6tq 110: propagation seqment = 7tq 111: propagation seqment = 8tq 11 sam 0: samples once (number of times sampled) 1: samples three times 12-15 no functions assigned 0 C can module 13.2 can module related registers
13 13-18 ver.0.10 (1) sjw bits (d0-d1) these bits set resynchronization jump width. (2) ph2 bits (d2-d4) these bits set the width of phase segment2. note: the internal can module of the m32r/e has ipt (information processing time) = 2. because ph2 bits = 0 after reset, be sure to change it to a value equal to or greater than 2 before you use the can module. (3) ph1 bits (d5-d7) these bits set the width of phase segment1. (4) prb bits (d8-d10) these bits set the width of propagation segment. (5) sam bit (d11) this bit sets the number of times each bit is sampled. when sam = 0, the value sampled at the end of phase segment1 is assumed to be the value of the bit. when sam = 1, the value of the bit is determined by a majority circuit from values sampled at three points-one sampled at the end of phase segment1, one sampled before 1tq, and one sampled before 2tq. table 13.2.1 typical settings of bit timing when cpu clock = 40 mhz baud rate brp set value tq period (ns) tq's for 1 bit prop+ph1 ph2 sampling point 1m bps 3 100 10 7 2 80% 3 100 10 6 3 70% 3 100 10 5 4 60% 4 125 8 5 2 75% 4 125 8 4 3 63% 500kbps 4 125 16 13 2 88% 4 125 16 12 3 81% 4 125 16 11 4 75% 7 200 10 7 2 80% 7 200 10 6 3 70% 7 200 10 5 4 60% 9 250 8 5 2 75% 9 250 8 4 3 63% can module 13.2 can module related registers
13 13-19 ver.0.10 13.2.5 can time stamp count register n can0 time stamp count register (can0tstmp) d bit name function r w 0-15 canstmp 16-bit counter value C the can module contains a 16-bit counter. the count period can be chosen to be the can bus bit period divided by 1, 2, 3, or 4 by setting the can control register (can0cnt)'s tsp (time stamp prescaler) bits. when the can module finishes transmitting or receiving, it captures the counter value and stores it in a message slot. the counter is made to start counting by clearing the can control register (can0cnt)'s rst bit to 0. note 1: the protocol control unit is reset and the counter is initialized to h'0000 by setting the can control register (can0cnt)'s rst (can reset) bit to 1. also, the counter can be initialized to h'0000 while the can module is operating by setting tsr (time stamp counter reset) bit to 1. note 2: during loopback mode, if an id-matching slot exists, the can module stores the time stamp value in the corresponding slot when it finished receiving. (no time stamp value is stored this way when the can module finished transmitting.) d0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 d15 cantstmp can module 13.2 can module related registers
13 13-20 ver.0.10 13.2.6 can error count registers n can0 receive error count register (can0rec) d bit name function r w 0-7 rec receive error count value C (receive error counter) in an error-active/error-passive state, a receive error count is stored in this register. when received normally, the counter counts down; when an error occurs, the counter counts up. when received normally while rec 128 (error-passive), rec is set to 127. in a bus-off state, an indeterminate value is stored in this register. the count is reset to h'00 upon returning to an error-active state. n can0 transmit error count register (can0tec) in an error-active/error-passive state, a transmit error count is stored in this register. when transmitted normally, the counter counts down; when an error occurs, the counter counts up. in a bus-off state, an indeterminate value is stored in this register. the count is reset to h'00 upon returning to an error-active state. d bit name function r w 8-15 tec transmit error count value C (transmit error counter) d8 9 1011121314d15 tec d0123456d7 rec can module 13.2 can module related registers
13 13-21 ver.0.10 13.2.7 can baud rate prescaler n can0 baud rate prescaler (can0brp) d bit name function r w 0-7 brp selects baud rate prescaler value d0123456d7 canbrp this register sets the tq period of can. the can baud rate is determined by (tq period x number of tq's for 1 bit). tq period = (canbrp + 1)/ cpu clock number of tq's for 1 bit = synchronization segment + progagation segment + phase segment 1 + phase segment 2 note: setting h'00 (divided by 1) is inhibited. can transfer baud rate = 1 tq period number of tq's for 1 bit can module 13.2 can module related registers
13 13-22 ver.0.10 13.2.8 can interrupt related registers n can0 slot interrupt status register (can0slist) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. d01234567891011121314d15 ssb0 ssb1 ssb2 ssb3 ssb4 ssb5 ssb6 ssb7 ssb8 ssb9 ssb10 ssb11 ssb12 ssb13 ssb14 ssb15 d bit name function r w 0 ssb0 (slot 0 interrupt request status) 0: no interrupt request 1 ssb1 (slot 1 interrupt request status) 1: interrupt requested 2 ssb2 (slot 2 interrupt request status) 3 ssb3 (slot 3 interrupt request status) 4 ssb4 (slot 4 interrupt request status) 5 ssb5 (slot 5 interrupt request status) 6 ssb6 (slot 6 interrupt request status) 7 ssb7 (slot 7 interrupt request status) 8 ssb8 (slot 8 interrupt request status) 9 ssb9 (slot 9 interrupt request status) 10 ssb10 (slot 10 interrupt request status) 11 ssb11 (slot 11 interrupt request status) 12 ssb12 (slot 12 interrupt request status) 13 ssb13 (slot 13 interrupt request status) 14 ssb14 (slot 14 interrupt request status) 15 ssb15 (slot 15 interrupt request status) can module 13.2 can module related registers
13 13-23 ver.0.10 when using can interrupts, this register lets you know which slot requested an interrupt. ? slots set for transmission the bit is set to 1 when the can module finished transmitting. the bit is cleared by writing a 0 in software. ? slots set for reception the bit is set to 1 when the can module finished receiving and finished storing the received message in the message slot. the bit is cleared by writing a 0 in software. when writing to the can slot interrupt status, make sure the bits you want to clear are set to 0 and all other bits are set to 1. the bits thus set to 1 are unaffected by writing in software and retain the value they had before you write. note 1: if the automatic response function is enabled for remote frame receive slots, the status is set after the can module received a remote frame and when it transmitted a data frame. note 2: for remote frame transmit slots, the status is set after the can module transmitted a remote frame and when it received a data frame. note 3: if the status is set by an interrupt request at the same time it is cleared in software, the former has priority so that the status is set. can module 13.2 can module related registers
13 13-24 ver.0.10 n can0 slot interrupt mask register (can0slimk) this register controls interrupt requests generated at completion of data transmission or reception in each corresponding slot by enabling or disabling them. when irbn (n = 0-15) is set to 1, interrupt requests to be generated at completion of transmission or reception in the corresponding slot are enabled. the can slot interrupt status register (can0slist) shows you which slot has requested the interrupt. d01234567891011121314d15 irb0 irb1 irb2 irb3 irb4 irb5 irb6 irb7 irb8 irb9 irb10 irb11 irb12 irb13 irb14 irb15 d bit name function r w 0 irb0 (slot 0 interrupt request mask) 0: masks (disables) interrupt request 1 irb1 (slot 1 interrupt request mask) 1: enables interrupt request 2 irb2 (slot 2 interrupt request mask) 3 irb3 (slot 3 interrupt request mask) 4 irb4 (slot 4 interrupt request mask) 5 irb5 (slot 5 interrupt request mask) 6 irb6 (slot 6 interrupt request mask) 7 irb7 (slot 7 interrupt request mask) 8 irb8 (slot 8 interrupt request mask) 9 irb9 (slot 9 interrupt request mask) 10 irb10 (slot 10 interrupt request mask) 11 irb11 (slot 11 interrupt request mask) 12 irb12 (slot 12 interrupt request mask) 13 irb13 (slot 13 interrupt request mask) 14 irb14 (slot 14 interrupt request mask) 15 irb15 (slot 15 interrupt request mask) can module 13.2 can module related registers
13 13-25 ver.0.10 n can0 error interrupt status register (can0erist) w = : only writing a 0 is effective; when you write a 1, the previous value is retained. when using can interrupts and the interrupt sources are associated with errors, this register lets you know which source generated the interrupt. (1) eis (can bus error interrupt status) bit (d5) this bit is set to 1 when a communication error is detected. this bit is cleared by writing a 0 in software. (2) pis (error passive interrupt status) bit (d6) this bit is set to 1 when the can module goes to an error passive state. this bit is cleared by writing a 0 in software. (3) ois (bus off interrupt status) bit (d7) this bit is set to 1 when the can module goes to a bus-off state. this bit is cleared by writing a 0 in software. when writing to the can error interrupt status, make sure the bits you want to clear are set to 0 and all other bits are set to 1. the bits thus set to 1 are unaffected by writing in software and retain the value they had before you write. d bit name function r w 0-4 no functions assigned 0 C 5 eis 0: no interrupt request (can bus error interrupt status) 1: interrupt requested 6 pis (error passive interrupt status) 7 ois (bus off interrupt status) d0123456d7 eis pis ois can module 13.2 can module related registers
13 13-26 ver.0.10 n can0 error interrupt mask register (can0erimk) (1) eim (can bus error interrupt mask) bit (d5) this bit controls interrupt requests generated for occurrence of can bus errors by enabling or disabling them. can bus error interrupt requests are enabled by setting this bit to 1. (2) pim (error passive interrupt mask) bit (d6) this bit controls interrupt requests generated when the can module enters an error passive state by enabling or disabling them. error passive interrupt requests are enabled by setting this bit to 1. (3) oim (bus off interrupt mask) bit (d7) this bit controls interrupt requests generated when the can module enters a bus-off state by enabling or disabling them. bus-off interrupt requests are enabled by setting this bit to 1. d8 9 1011121314d15 eim pim oim d bit name function r w 8-12 no functions assigned 0 C 13 eim 0: masks (disables) interrupt request (can bus error interrupt mask) 1: enables interrupt request 14 pim (error passive interrupt mask) 15 oim (bus off interrupt mask) can module 13.2 can module related registers
13 13-27 ver.0.10 figure 13.2.5 block diagram of can0 group interrupts (1/3) can module 13.2 can module related registers can0 transmit/receive & error interrupts data bus b0 irb0 f/f ssb0 f/f b0 b1 irb1 f/f ssb1 f/f b1 b2 irb2 f/f ssb2 f/f b2 b3 irb3 f/f ssb3 f/f b3 b4 irb4 f/f ssb4 f/f b4 (level) 19-source inputs can0slist can0slimk slot 0 transmit/receive completed b5 irb5 f/f ssb5 f/f b5 b6 irb6 f/f ssb6 f/f b6 b7 irb7 f/f to remaining 11-source inputs in the next page f/f b7 ~ ssb7 slot 1 transmit/receive completed slot 2 transmit/receive completed slot 3 transmit/receive completed slot 4 transmit/receive completed slot 5 transmit/receive completed slot 6 transmit/receive completed slot 7 transmit/receive completed
13 13-28 ver.0.10 figure 13.2.6 block diagram of can0 group interrupts (2/3) can module 13.2 can module related registers ~ to preceding page b8 irb8 f/f ssb8 f/f b8 b9 irb9 f/f ssb9 f/f b9 b10 irb10 f/f ssb10 f/f b10 b11 irb11 f/f ssb11 f/f b11 b12 irb12 f/f ssb12 f/f b12 can0slist can0slimk b13 irb13 f/f ssb13 f/f b13 b14 irb14 f/f ssb14 f/f b14 b15 irb15 f/f f/f b15 ssb15 data bus (level) 19-source inputs slot 8 transmit/receive completed to remaining 3-source inputs in the next page slot 9 transmit/receive completed slot 10 transmit/receive completed slot 11 transmit/receive completed slot 12 transmit/receive completed slot 13 transmit/receive completed slot 14 transmit/receive completed slot 15 transmit/receive completed
13 13-29 ver.0.10 figure 13.2.7 block diagram of can0 group interrupts (3/3) can module 13.2 can module related registers b5 eim f/f eis f/f b13 b6 pim f/f pis f/f b14 b7 oim f/f ois f/f b15 can0erist can0erimk can bus error occurs go to error passive state go to bus-off state to preceding page data bus (level) 19-source inputs
13 13-30 ver.0.10 13.2.9 can mask registers n can0 global mask register standard id0 (c0gmsks0) n can0 local mask register a standard id0 (c0lmskas0) n can0 local mask register b standard id0 (c0lmskbs0) n can0 global mask register standard id1 (c0gmsks1) n can0 local mask register a standard id1 (c0lmskas1) n can0 local mask register b standard id1 (c0lmskbs1) d bit name function r w 0-2 no functions assigned 0 C 3-7 sid0m-sid4m 0: id not checked (standard id0 to standard id4) 1: id checked d0123456d7 sid0m sid1m sid2m sid3m sid4m d bit name function r w 8-9 no functions assigned 0 C 10-15 sid5m-sid10m 0: id not checked (standard id5 to standard id10) 1: id checked d8 9 1011121314d15 sid5m sid6m sid7m sid8m sid9m sid10m can module 13.2 can module related registers
13 13-31 ver.0.10 three registers are used in acceptance filtering: global mask register, local mask register a, and local mask register b. the global mask register is used for message slots 0-13, while local mask registers a and b are used for message slots 14 and 15, respectively. ? when a bit in this register is set to 0, its corresponding id bit is masked (assumed to have matched) during acceptance filtering. ? when a bit in this register is set to 1, its corresponding id bit is compared with the receive id during acceptance filtering and when it matches the id set for the message slot, the received data is stored in it. note 1: sid0m corresponds to the msb of standard id. note 2: the global mask register can only be changed when none of slots 0-13 have receive requests set. note 3: the local mask register a can only be changed when slot 14 does not have a receive request set. note 4: the local mask register b can only be changed when slot 15 does not have a receive request set. can module 13.2 can module related registers
13 13-32 ver.0.10 n can0 global mask register extended id1 (c0gmske1) n can0 local mask register a extended id1 (c0lmskae1) n can0 local mask register b extended id1 (c0lmskbe1) n can0 global mask register extended id0 (c0gmske0) n can0 local mask register a extended id0 (c0lmskae0) n can0 local mask register b extended id0 (c0lmskbe0) d bit name function r w 0-3 no functions assigned 0 C 4-7 eid0m-eid3m 0: id not checked (extended id0 to extended id3) 1: id checked d0123456d7 eid0m eid1m eid2m eid3m d8 9 1011121314d15 eid4m eid5m eid6m eid7m eid8m eid9m eid10m eid11m d bit name function r w 8-15 eid4m-eid11m 0: id not checked (extended id4 to extended id11) 1: id checked can module 13.2 can module related registers
13 13-33 ver.0.10 n can0 global mask register extended id2 (c0gmske2) n can0 local mask register a extended id2 (c0lmskae2) n can0 local mask register b extended id2 (c0lmskbe2) three registers are used in acceptance filtering: global mask register, local mask register a, and local mask register b. the global mask register is used for message slots 0-13, while local mask registers a and b are used for message slots 14 and 15, respectively. ? when a bit in this register is set to 0, its corresponding id bit is masked (assumed to have matched) during acceptance filtering. ? when a bit in this register is set to 1, its corresponding id bit is compared with the receive id during acceptance filtering and when it matches the id set for the message slot, the received data is stored in it. note 1: eid0m corresponds to the msb of extended id. note 2: the global mask register can only be changed when none of slots 0-13 have receive requests set. note 3: the local mask register a can only be changed when slot 14 does not have a receive request set. note 4: the local mask register b can only be changed when slot 15 does not have a receive request set. d0123456d7 eid12m eid13m eid14m eid15m eid16m eid17m d bit name function r w 0,1 no functions assigned 0 C 2-7 eid12m-eid17m 0: id not checked (extended id12 to extended id17) 1: id checked can module 13.2 can module related registers
13 13-34 ver.0.10 13.2.10 can message slot control registers n can0 message slot0 control registers (comsl0cnt) n can0 message slot1 control registers (comsl1cnt) n can0 message slot2 control registers (comsl2cnt) n can0 message slot3 control registers (comsl3cnt) n can0 message slot4 control registers (comsl4cnt) n can0 message slot5 control registers (comsl5cnt) n can0 message slot6 control registers (comsl6cnt) n can0 message slot7 control registers (comsl7cnt) n can0 message slot8 control registers (comsl8cnt) n can0 message slot9 control registers (comsl9cnt) n can0 message slot10 control registers (comsl10cnt) n can0 message slot11 control registers (comsl11cnt) n can0 message slot12 control registers (comsl12cnt) n can0 message slot13 control registers (comsl13cnt) n can0 message slot14 control registers (comsl14cnt) n can0 message slot15 control registers (comsl15cnt) d bit name function r w 0tr 0: does not use message slot as transmit slot (transmit request) 1: uses message slot as transmit slot 1rr 0: does not use message slot as receive slot (receive request) 1: uses message slot as receive slot 2 rm 0: transmits/receives data frame (remote) 1: transmits/receives remote frame 3rl 0: enables automatic response for remote frame (automatic response inhibit) 1: disables automatic response for remote frame 4 ra basiccan mode C (remote active) 0: receives data frame (status) 1: receives remote frame (status) normal mode 0: data frame 1: remote frame d0(d8) 1 2 3 4 5 6 d7(d15) tr rr rm rl ra ml trstat trfin can module 13.2 can module related registers
13 13-35 ver.0.10 w = : only writing a 0 is effective; when you write a 1, the previous value is retained. (1) tr (transmit request) bit (d0) to use the message slot as a transmit slot, set this bit to 1. to use the message slot as a data frame or remote frame receive slot, set this bit to 0. (2) rr (receive request) bit (d1) to use the message slot as a receive slot, set this bit to 1. to use the message slot as a data frame or remote frame transmit slot, set this bit to 0. if both tr (transmit request) and rr (receive request) bits are set to 1, device operation is indeterminate. d bit name function r w 5 ml 0: message-lost not occurred (message slot) 1: message-lost occurred 6 trstat for transmit slots C (transmit/receive status) 0: transmission idle 1: transmit request accepted for receive slots 0: reception idle 1: storing received data 7 trfin for transmit slots (transmit/receive complete) 0: not transmitted yet 1: finished transmitting for receive slots 0: not received yet 1: finished receiving can module 13.2 can module related registers
13 13-36 ver.0.10 (3) rm (remote) bit (d2) to handle remote frames in the message slot, set this bit to 1. the message slot may be set to handle remote frames in following two ways: ? set for remote frame transmission the data set in the message slot is transmitted as a remote frame. when the can module finished transmitting, the slot is automatically changed to a data frame receive slot. however, if a data frame is received before the can module finished sending a remote frame, the data is stored in the message slot and the remote frame is not transmitted. ? set for remote frame reception remote frames are received. the processing to be performed after receiving a remote frame is selected by rl (automatic response inhibit) bit. (4) rl (automatic response inhibit) bit (d3) this bit is effective when the message slot has been set as a remote frame receive slot. it selects the processing to be performed after receiving a remote frame. when this bit is set to 0, the message slot automatically changes to a transmit slot after receiving a remote frame and transmits the data set in it as a data frame. when this bit is set to 1, the message slot stops operating after receiving a remote frame. note: always set this bit to 0 unless the message slot is set for remote frame reception. (5) ra (remote active) bit (d4) this bit functions differently for slots 0-13 and slots 14 and 15. ? slots 0-13 this bit is set to 1 when the message slot is set for remote frame transmission (reception). then it is cleared to 0 when remote frame transmission (reception) is completed. ? slots 14, 15 the function of this bit differs depending on how the can control register's bcm (basiccan mode) bit is set. if bcm = 0 (normal operation), this bit is set to 1 when the message slot is set for remote frame transmission (reception). if bcm = 1 (basiccan), this bit shows which type of frame is received. in basiccan mode, the received data is stored in slots 14 and 15 for both data frame and remote frame. if ra = 0, it means that the frame stored in the slot is a data frame; if ra = 1, it means that the frame stored in the slot is a remote frame. can module 13.2 can module related registers
13 13-37 ver.0.10 (6) ml (message lost) bit (d5) this bit is effective for receive slots. it is set to 1 when the message slot contains unread receive data which is overwritten by reception. this bit is cleared by writing a 0 in software. (7) trstat (transmit/receive status) bit (d6) this bit indicates that the can module is transmitting or receiving and is accessing the message slot. this bit is set to 1 when the can module is accessing, and set to 0 when not accessing. ? for transmit slots this bit is set to 1 when a transmit request for the message slot is accepted. it is cleared to 0 when the can module lost bus arbitration, when a can bus error occurs, or when transmission is completed. ? for receive slots this bit is set to 1 when during data reception, the received data is being stored in the message slot. note that the value read from message slot while trstat bit remains set is indeterminate. (8) trfin (transmit/receive finished) bit (d7) this bit indicates that the can module finished transmitting or receiving. ? when set for transmit slots this bit is set to 1 when the can module finished transmitting the data stored in the message slot. this bit is cleared by writing a 0 in software. however, it cannot be cleared when trstat (transmit/receive status) bit = 1. ? when set for receive slots this bit is set to 1 when the can module finished receiving normally the data to be stored in the message slot. this bit is cleared by writing a 0 in software. however, it cannot be cleared when trstat (transmit/receive status) bit = 1. note 1: before you can read received data from the message slot, you must clear the trfin (transmit/receive finished) bit. note also that if the trfin (transmit/receive finished) bit is set to 1 after you read data, it means that new receive data was stored while you were reading and the data you read contains an indeterminate value. in this case, discard the read data, clear the trfin (transmit/receive finished) bit, and read out data again. note 2: the trfin (transmit/receive finished) bit has no effect for remote frames, so that it is not set when remote frame transmission or reception is completed. can module 13.2 can module related registers
13 13-38 ver.0.10 13.2.11 can message slots n can0 message slot 0 standard id0 (c0msl0sid0) n can0 message slot 1 standard id0 (c0msl1sid0) n can0 message slot 2 standard id0 (c0msl2sid0) n can0 message slot 3 standard id0 (c0msl3sid0) n can0 message slot 4 standard id0 (c0msl4sid0) n can0 message slot 5 standard id0 (c0msl5sid0) n can0 message slot 6 standard id0 (c0msl6sid0) n can0 message slot 7 standard id0 (c0msl7sid0) n can0 message slot 8 standard id0 (c0msl8sid0) n can0 message slot 9 standard id0 (c0msl9sid0) n can0 message slot 10 standard id0 (c0msl10sid0) n can0 message slot 11 standard id0 (c0msl11sid0) n can0 message slot 12 standard id0 (c0msl12sid0) n can0 message slot 13 standard id0 (c0msl13sid0) n can0 message slot 14 standard id0 (c0msl14sid0) n can0 message slot 15 standard id0 (c0msl15sid0) d bit name function r w 0-2 no functions assigned 0 C 3-7 sid0-sid4 standard id0 to standard id4 (standard id0 to standard id4) these registers are the transmit frame/receive frame memory space. d0123456d7 sid0 sid1 sid2 sid3 sid4 can module 13.2 can module related registers
13 13-39 ver.0.10 n can0 message slot 0 standard id1 (c0msl0sid1) n can0 message slot 1 standard id1 (c0msl1sid1) n can0 message slot 2 standard id1 (c0msl2sid1) n can0 message slot 3 standard id1 (c0msl3sid1) n can0 message slot 4 standard id1 (c0msl4sid1) n can0 message slot 5 standard id1 (c0msl5sid1) n can0 message slot 6 standard id1 (c0msl6sid1) n can0 message slot 7 standard id1 (c0msl7sid1) n can0 message slot 8 standard id1 (c0msl8sid1) n can0 message slot 9 standard id1 (c0msl9sid1) n can0 message slot 10 standard id1 (c0msl10sid1) n can0 message slot 11 standard id1 (c0msl11sid1) n can0 message slot 12 standard id1 (c0msl12sid1) n can0 message slot 13 standard id1 (c0msl13sid1) n can0 message slot 14 standard id1 (c0msl14sid1) n can0 message slot 15 standard id1 (c0msl15sid1) d8 9 1011121314d15 sid5 sid6 sid7 sid8 sid9 sid10 d bit name function r w 8,9 no functions assigned 0 C 10-15 sid5-sid10 standard id5 to standard id10 (standard id5 to standard id10) these registers are the transmit frame/receive frame memory space. can module 13.2 can module related registers
13 13-40 ver.0.10 n can0 message slot 0 extended id0 (c0msl0eid0) n can0 message slot 1 extended id0 (c0msl1eid0) n can0 message slot 2 extended id0 (c0msl2eid0) n can0 message slot 3 extended id0 (c0msl3eid0) n can0 message slot 4 extended id0 (c0msl4eid0) n can0 message slot 5 extended id0 (c0msl5eid0) n can0 message slot 6 extended id0 (c0msl6eid0) n can0 message slot 7 extended id0 (c0msl7eid0) n can0 message slot 8 extended id0 (c0msl8eid0) n can0 message slot 9 extended id0 (c0msl9eid0) n can0 message slot 10 extended id0 (c0msl10eid0) n can0 message slot 11 extended id0 (c0msl11eid0) n can0 message slot 12 extended id0 (c0msl12eid0) n can0 message slot 13 extended id0 (c0msl13eid0) n can0 message slot 14 extended id0 (c0msl14eid0) n can0 message slot 15 extended id0 (c0msl15eid0) these registers are the transmit frame/receive frame memory space. note: when set for the receive slot standard id format, values written to eid bits when storing received data in the slot are indeterminate. d bit name function r w 0-3 no functions assigned 0 C 4-7 eid0-eid3 extended id0 to extended id3 (extended id0 to extended id3) d0123456d7 eid0 eid1 eid2 eid3 can module 13.2 can module related registers
13 13-41 ver.0.10 n can0 message slot 0 extended id1 (c0msl0eid1) n can0 message slot 1 extended id1 (c0msl1eid1) n can0 message slot 2 extended id1 (c0msl2eid1) n can0 message slot 3 extended id1 (c0msl3eid1) n can0 message slot 4 extended id1 (c0msl4eid1) n can0 message slot 5 extended id1 (c0msl5eid1) n can0 message slot 6 extended id1 (c0msl6eid1) n can0 message slot 7 extended id1 (c0msl7eid1) n can0 message slot 8 extended id1 (c0msl8eid1) n can0 message slot 9 extended id1 (c0msl9eid1) n can0 message slot 10 extended id1 (c0msl10eid1) n can0 message slot 11 extended id1 (c0msl11eid1) n can0 message slot 12 extended id1 (c0msl12eid1) n can0 message slot 13 extended id1 (c0msl13eid1) n can0 message slot 14 extended id1 (c0msl14eid1) n can0 message slot 15 extended id1 (c0msl15eid1) these registers are the transmit frame/receive frame memory space. note: when set for the receive slot standard id format, values written to eid bits when storing received data in the slot are indeterminate. d8 9 1011121314d15 eid4 eid5 eid6 eid7 eid8 eid9 eid10 eid11 d bit name function r w 8-15 eid4-eid11 extended id4 to extended id11 (extended id4 to extended id11) can module 13.2 can module related registers
13 13-42 ver.0.10 n can0 message slot 0 extended id2 (c0msl0eid2) n can0 message slot 1 extended id2 (c0msl1eid2) n can0 message slot 2 extended id2 (c0msl2eid2) n can0 message slot 3 extended id2 (c0msl3eid2) n can0 message slot 4 extended id2 (c0msl4eid2) n can0 message slot 5 extended id2 (c0msl5eid2) n can0 message slot 6 extended id2 (c0msl6eid2) n can0 message slot 7 extended id2 (c0msl7eid2) n can0 message slot 8 extended id2 (c0msl8eid2) n can0 message slot 9 extended id2 (c0msl9eid2) n can0 message slot 10 extended id2 (c0msl10eid2) n can0 message slot 11 extended id2 (c0msl11eid2) n can0 message slot 12 extended id2 (c0msl12eid2) n can0 message slot 13 extended id2 (c0msl13eid2) n can0 message slot 14 extended id2 (c0msl14eid2) n can0 message slot 15 extended id2 (c0msl15eid2) these registers are the transmit frame/receive frame memory space. note: when set for the receive slot standard id format, values written to eid bits when storing received data in the slot are indeterminate. d bit name function r w 0,1 no functions assigned 0 C 2-7 eid12-eid17 extended id12 to extended id17 (extended id12 to extended id17) d0123456d7 eid12 eid13 eid14 eid15 eid16 eid17 can module 13.2 can module related registers
13 13-43 ver.0.10 n can0 message slot 0 data length register (c0msl0dlc) n can0 message slot 1 data length register (c0msl1dlc) n can0 message slot 2 data length register (c0msl2dlc) n can0 message slot 3 data length register (c0msl3dlc) n can0 message slot 4 data length register (c0msl4dlc) n can0 message slot 5 data length register (c0msl5dlc) n can0 message slot 6 data length register (c0msl6dlc) n can0 message slot 7 data length register (c0msl7dlc) n can0 message slot 8 data length register (c0msl8dlc) n can0 message slot 9 data length register (c0msl9dlc) n can0 message slot 10 data length register (c0msl10dlc) n can0 message slot 11 data length register (c0msl11dlc) n can0 message slot 12 data length register (c0msl12dlc) n can0 message slot 13 data length register (c0msl13dlc) n can0 message slot 14 data length register (c0msl14dlc) n can0 message slot 15 data length register (c0msl15dlc) d8 9 1011121314d15 dlc0 dlc1 dlc2 dlc3 d bit name function r w 8-11 no functions assigned 0 C 12-15 dlc0-dlc3 0 0 0 0 : 0 byte (sets data length) 0 0 0 1 : 1 byte 0 0 1 0 : 2 byte 0 0 1 1 : 3 byte 0 1 0 0 : 4 byte 0 1 0 1 : 5 byte 0 1 1 0 : 6 byte 0 1 1 1 : 7 byte 1 x x x : 8 byte these registers are the transmit frame/receive frame memory space. when transmitting, the register sets the length of transmit data. when receiving, the register stores the received dlc. can module 13.2 can module related registers
13 13-44 ver.0.10 n can0 message slot 0 data 0 (c0msl0dt0) n can0 message slot 1 data 0 (c0msl1dt0) n can0 message slot 2 data 0 (c0msl2dt0) n can0 message slot 3 data 0 (c0msl3dt0) n can0 message slot 4 data 0 (c0msl4dt0) n can0 message slot 5 data 0 (c0msl5dt0) n can0 message slot 6 data 0 (c0msl6dt0) n can0 message slot 7 data 0 (c0msl7dt0) n can0 message slot 8 data 0 (c0msl8dt0) n can0 message slot 9 data 0 (c0msl9dt0) n can0 message slot 10 data 0 (c0msl10dt0) n can0 message slot 11 data 0 (c0msl11dt0) n can0 message slot 12 data 0 (c0msl12dt0) n can0 message slot 13 data 0 (c0msl13dt0) n can0 message slot 14 data 0 (c0msl14dt0) n can0 message slot 15 data 0 (c0msl15dt0) these registers are the transmit frame/receive frame memory space. note: for receive slots, if when storing a data frame the data length (dlc value) = 0, an indeterminate value is written to this register. d bit name function r w 0-7 comslndt0 message slot n data 0 d0123456d7 c0mslndt0 can module 13.2 can module related registers
13 13-45 ver.0.10 n can0 message slot 0 data 1 (c0msl0dt1) n can0 message slot 1 data 1 (c0msl1dt1) n can0 message slot 2 data 1 (c0msl2dt1) n can0 message slot 3 data 1 (c0msl3dt1) n can0 message slot 4 data 1 (c0msl4dt1) n can0 message slot 5 data 1 (c0msl5dt1) n can0 message slot 6 data 1 (c0msl6dt1) n can0 message slot 7 data 1 (c0msl7dt1) n can0 message slot 8 data 1 (c0msl8dt1) n can0 message slot 9 data 1 (c0msl9dt1) n can0 message slot 10 data 1 (c0msl10dt1) n can0 message slot 11 data 1 (c0msl11dt1) n can0 message slot 12 data 1 (c0msl12dt1) n can0 message slot 13 data 1 (c0msl13dt1) n can0 message slot 14 data 1 (c0msl14dt1) n can0 message slot 15 data 1 (c0msl15dt1) these registers are the transmit frame/receive frame memory space. note: for receive slots, if when storing a data frame the data length (dlc value) = 1, an indeterminate value is written to this register. d bit name function r w 8-15 comslndt1 message slot n data 1 d8 9 1011121314d15 c0mslndt1 can module 13.2 can module related registers
13 13-46 ver.0.10 n can0 message slot 0 data 2 (c0msl0dt2) n can0 message slot 1 data 2 (c0msl1dt2) n can0 message slot 2 data 2 (c0msl2dt2) n can0 message slot 3 data 2 (c0msl3dt2) n can0 message slot 4 data 2 (c0msl4dt2) n can0 message slot 5 data 2 (c0msl5dt2) n can0 message slot 6 data 2 (c0msl6dt2) n can0 message slot 7 data 2 (c0msl7dt2) n can0 message slot 8 data 2 (c0msl8dt2) n can0 message slot 9 data 2 (c0msl9dt2) n can0 message slot 10 data 2 (c0msl10dt2) n can0 message slot 11 data 2 (c0msl11dt2) n can0 message slot 12 data 2 (c0msl12dt2) n can0 message slot 13 data 2 (c0msl13dt2) n can0 message slot 14 data 2 (c0msl14dt2) n can0 message slot 15 data 2 (c0msl15dt2) these registers are the transmit frame/receive frame memory space. note: for receive slots, if when storing a data frame the data length (dlc value) = 2, an indeterminate value is written to this register. d bit name function r w 0-7 comslndt2 message slot n data 2 can module 13.2 can module related registers d0123456d7 c0mslndt2
13 13-47 ver.0.10 n can0 message slot 0 data 3 (c0msl0dt3) n can0 message slot 1 data 3 (c0msl1dt3) n can0 message slot 2 data 3 (c0msl2dt3) n can0 message slot 3 data 3 (c0msl3dt3) n can0 message slot 4 data 3 (c0msl4dt3) n can0 message slot 5 data 3 (c0msl5dt3) n can0 message slot 6 data 3 (c0msl6dt3) n can0 message slot 7 data 3 (c0msl7dt3) n can0 message slot 8 data 3 (c0msl8dt3) n can0 message slot 9 data 3 (c0msl9dt3) n can0 message slot 10 data 3 (c0msl10dt3) n can0 message slot 11 data 3 (c0msl11dt3) n can0 message slot 12 data 3 (c0msl12dt3) n can0 message slot 13 data 3 (c0msl13dt3) n can0 message slot 14 data 3 (c0msl14dt3) n can0 message slot 15 data 3 (c0msl15dt3) these registers are the transmit frame/receive frame memory space. note: for receive slots, if when storing a data frame the data length (dlc value) = 3, an indeterminate value is written to this register. d bit name function r w 8-15 comslndt3 message slot n data 3 d8 9 1011121314d15 c0mslndt3 can module 13.2 can module related registers
13 13-48 ver.0.10 n can0 message slot 0 data 4 (c0msl0dt4) n can0 message slot 1 data 4 (c0msl1dt4) n can0 message slot 2 data 4 (c0msl2dt4) n can0 message slot 3 data 4 (c0msl3dt4) n can0 message slot 4 data 4 (c0msl4dt4) n can0 message slot 5 data 4 (c0msl5dt4) n can0 message slot 6 data 4 (c0msl6dt4) n can0 message slot 7 data 4 (c0msl7dt4) n can0 message slot 8 data 4 (c0msl8dt4) n can0 message slot 9 data 4 (c0msl9dt4) n can0 message slot 10 data 4 (c0msl10dt4) n can0 message slot 11 data 4 (c0msl11dt4) n can0 message slot 12 data 4 (c0msl12dt4) n can0 message slot 13 data 4 (c0msl13dt4) n can0 message slot 14 data 4 (c0msl14dt4) n can0 message slot 15 data 4 (c0msl15dt4) these registers are the transmit frame/receive frame memory space. note: for receive slots, if when storing a data frame the data length (dlc value) = 4, an indeterminate value is written to this register. d bit name function r w 0-7 comslndt4 message slot n data 4 can module 13.2 can module related registers d0123456d7 c0mslndt4
13 13-49 ver.0.10 n can0 message slot 0 data 5 (c0msl0dt5) n can0 message slot 1 data 5 (c0msl1dt5) n can0 message slot 2 data 5 (c0msl2dt5) n can0 message slot 3 data 5 (c0msl3dt5) n can0 message slot 4 data 5 (c0msl4dt5) n can0 message slot 5 data 5 (c0msl5dt5) n can0 message slot 6 data 5 (c0msl6dt5) n can0 message slot 7 data 5 (c0msl7dt5) n can0 message slot 8 data 5 (c0msl8dt5) n can0 message slot 9 data 5 (c0msl9dt5) n can0 message slot 10 data 5 (c0msl10dt5) n can0 message slot 11 data 5 (c0msl11dt5) n can0 message slot 12 data 5 (c0msl12dt5) n can0 message slot 13 data 5 (c0msl13dt5) n can0 message slot 14 data 5 (c0msl14dt5) n can0 message slot 15 data 5 (c0msl15dt5) these registers are the transmit frame/receive frame memory space. note: for receive slots, if when storing a data frame the data length (dlc value) = 5, an indeterminate value is written to this register. d bit name function r w 8-15 comslndt5 message slot n data 5 d8 9 1011121314d15 c0mslndt5 can module 13.2 can module related registers
13 13-50 ver.0.10 n can0 message slot 0 data 6 (c0msl0dt6) n can0 message slot 1 data 6 (c0msl1dt6) n can0 message slot 2 data 6 (c0msl2dt6) n can0 message slot 3 data 6 (c0msl3dt6) n can0 message slot 4 data 6 (c0msl4dt6) n can0 message slot 5 data 6 (c0msl5dt6) n can0 message slot 6 data 6 (c0msl6dt6) n can0 message slot 7 data 6 (c0msl7dt6) n can0 message slot 8 data 6 (c0msl8dt6) n can0 message slot 9 data 6 (c0msl9dt6) n can0 message slot 10 data 6 (c0msl10dt6) n can0 message slot 11 data 6 (c0msl11dt6) n can0 message slot 12 data 6 (c0msl12dt6) n can0 message slot 13 data 6 (c0msl13dt6) n can0 message slot 14 data 6 (c0msl14dt6) n can0 message slot 15 data 6 (c0msl15dt6) these registers are the transmit frame/receive frame memory space. note: for receive slots, if when storing a data frame the data length (dlc value) = 6, an indeterminate value is written to this register. d bit name function r w 0-7 comslndt6 message slot n data 6 d0123456d7 c0mslndt6 can module 13.2 can module related registers
13 13-51 ver.0.10 n can0 message slot 0 data 7 (c0msl0dt7) n can0 message slot 1 data 7 (c0msl1dt7) n can0 message slot 2 data 7 (c0msl2dt7) n can0 message slot 3 data 7 (c0msl3dt7) n can0 message slot 4 data 7 (c0msl4dt7) n can0 message slot 5 data 7 (c0msl5dt7) n can0 message slot 6 data 7 (c0msl6dt7) n can0 message slot 7 data 7 (c0msl7dt7) n can0 message slot 8 data 7 (c0msl8dt7) n can0 message slot 9 data 7 (c0msl9dt7) n can0 message slot 10 data 7 (c0msl10dt7) n can0 message slot 11 data 7 (c0msl11dt7) n can0 message slot 12 data 7 (c0msl12dt7) n can0 message slot 13 data 7 (c0msl13dt7) n can0 message slot 14 data 7 (c0msl14dt7) n can0 message slot 15 data 7 (c0msl15dt7) these registers are the transmit frame/receive frame memory space. note: for receive slots, if when storing a data frame the data length (dlc value) = 7, an indeterminate value is written to this register. d bit name function r w 0-7 comslndt7 message slot n data 7 d8 9 1011121314d15 c0mslndt7 can module 13.2 can module related registers
13 13-52 ver.0.10 n can0 message slot 0 time stamp (c0msl0tsp) n can0 message slot 1 time stamp (c0msl1tsp) n can0 message slot 2 time stamp (c0msl2tsp) n can0 message slot 3 time stamp (c0msl3tsp) n can0 message slot 4 time stamp (c0msl4tsp) n can0 message slot 5 time stamp (c0msl5tsp) n can0 message slot 6 time stamp (c0msl6tsp) n can0 message slot 7 time stamp (c0msl7tsp) n can0 message slot 8 time stamp (c0msl8tsp) n can0 message slot 9 time stamp (c0msl9tsp) n can0 message slot 10 time stamp (c0msl10tsp) n can0 message slot 11 time stamp (c0msl11tsp) n can0 message slot 12 time stamp (c0msl12tsp) n can0 message slot 13 time stamp (c0msl13tsp) n can0 message slot 14 time stamp (c0msl14tsp) n can0 message slot 15 time stamp (c0msl15tsp) these registers are the transmit frame/receive frame memory space. when the can module finishes transmitting or receiving, the can0 time stamp count register value is set in this register. d bit name function r w 0-15 comslntsp message slot n time stamp d01234567891011121314d15 c0mslntsp can module 13.2 can module related registers
13 13-53 ver.0.10 13.3 can protocol 13.3.1 can protocol frame there are four types of frames which are handled by can protocol: (1) data frame (2) remote frame (3) error frame (4) overload frame frames are separated from each another by an interframe space. sof arbitration field control field data field crc field ack field eof 11 1 6 0-64 16 2 7 11 11 1 18 6 0-64 16 2 7 sof eof 11 1 6 16 2 7 11 11 1 18 6 16 27 data frame remote frame standard format extended format numbers in each field denote the number of bits. standard format extended format arbitration field control field crc field ack field 1 1 1 1 figure 13.3.1 can protocol frames (1) can module 13.3 can protocol
13 13-54 ver.0.10 error flag error delimiter interframe space or overload flag 6-12 8 overload flag overload delimiter 6-12 8 error frame overload frame interframe space intermission bus idle sof of next frame in an error-active state 3 0- sof suspend transmission in an error-passive state 38 0- sof numbers in each field denote the number of bits. interframe space or overload flag intermission bus idle sof of next frame figure 13.3.2 can protocol frames (2) can module 13.3 can protocol
13 13-55 ver.0.10 can module 13.3 can protocol transmit error counter > 255 transmit error counter 3 128 or receive error counter 3 128 transmit error counter < 128 and receive error counter < 128 11 consecutive recessive bits detected on can bus 128 times or reset by software error-active state error-passive state bus-off state initial settings figure 13.3.3 can control error states the can controller assumes one of the following three error states depending on the transmit error and receive error counter values. (1) error-active state ? this is a state where almost no errors have occurred. ? when an error is detected, an active error flag is transmitted. ? immediately after being initialized, the can controller is in this state. (2) error-passive state ? this is a state where many errors have occurred. ? when an error is detected, a passive error flag is transmitted. (3) bus-off state ? this is a state where a large number of errors have occurred. ? can communication with other nodes cannot be performed until the can module returns to an error-active state. error status of the unit error-active state error-passive state bus-off state transmit error counter receive error counter 0-127 and 0-127 128-255 or 128- 256-
13 13-56 ver.0.10 13.4 initializing the can module 13.4.1 initialization of the can module before you perform communication, set up the can module as described below. (1) selecting pin functions the can transmit data output pin (ctx) and can data receive input pin (crx) are shared with input/output ports, so be sure to select the functions of these pins. (refer to chapter 8, "input/ output ports and pin functions." (2) setting the interrupt controller (icu) when you use can module interrupts, set the interrupt priority. (3) setting can error interrupt mask and can slot interrupt mask registers when you use can bus error interrupts, can error passive interrupts, can error bus-off interrupts, or can slot interrupts, set each corresponding bit to 1 to enable interrupt requests. (4) setting bit timing and the number of times sampled using the can configuration register and can baud rate prescaler, set the bit timing and the number of times the can bus is sampled. setting the bit timing determine the period tq that is the base of bit timing, the configuration of propagation segment, phase segment1, and phase segment2, and resynchronization jump width. the equation to calculate tq is shown below. tq = (canbrp+1) /cpu clock the baud rate is determined by the number of tq's that comprise one bit. the equation to calculate the baud rate is shown below. number of tq's for 1 bit = synchronization segment + propagation segment + phase segment 1 + phase segment 2 baud rate (bps) = 1 tq period number of tq's for 1 bit can module 13.4 initializing the can module
13 13-57 ver.0.10 figure 13.4.1 example of bit timing setting the number of times sampled select the number of times the can bus is sampled from "one time" and "three times." when you select one-time sampling, the value sampled at the end of phase segment1 is assumed to be the value of the bit. when you select three-time sampling, the value of the bit is determined by majority from values sampled at three points, i.e., the value sampled at the first point and those sampled one tq before and two tq's before that. (5) setting id mask registers set the values of id mask registers (global mask register, local mask register a, and local mask register b) which are used in acceptance filtering of received messages. (6) settings when running in basiccan mode set the can extended id register ide14 and ide15 bits. (we recommend setting the same value in these bits.) set ids for message slots 14 and 15. set the message control registers 14 and 15 for data frame reception (h'40). (7) setting can module operation mode using the can control register (can0cnt), select the can module's operation mode (basiccan or loopback mode) and the clock source for the time stamp counter. (8) releasing the can module from reset after you finished settings (1) through (7) above, clear the can control register (can0cnt)'s forcible reset bit (frst) and reset bit (rst) to 0. then, after detecting 11 consecutive "recessive" bits on the can bus, the can module becomes ready to communicate. shown in this diagram is the bit timing for cases where one bit consists of 8 tq's. when one-time sampling is selected, the value sampled at sampling point (1) is assumed to be the value of the bit. when three-time sampling is selected, the value of the bit is determined by majority from can bus values sampled at sampling points (1), (2), and (3). can module 13.4 initializing the can module synchronization segment propagation segment phase segment1 phase segment2 (1) (2) (3) sampling point 1tq 1 bit rate
13 13-58 ver.0.10 figure 13.4.2 initializing the can module can module 13.4 initializing the can module initialize can module set input/output port operation mode register set interrupt controller set can related interrupt mask register set can configuration register set id mask register set can operation mode negate can reset can module initialization completed set interrupt priority ?enable/disable can error passive interrupt ?enable/disable can bus error interrupt ?enable/disable can bus off interrupt ?set the number of times sampled ?set bit timing (baud rate) set id mask bit set basiccan mode release can module from reset ?enable/disable interrupt to be generated at completion of transmission or reception in the slot set can error interrupt mask register set can slot interrupt mask register ?set can extended idregister ?set ids for message slots 14 and 15 ?set message slot control register set loopback mode
13 13-59 ver.0.10 13.5 transmitting data frames 13.5.1 data frame transmit procedure the following describes the procedure for transmitting data frames. (1) initializing the can message slot control register initialize the can message slot control register for the slot in which you want to transmit by writing h'00 to the register. (2) confirming that transmission is idle read the can message slot control register after being initialized and check the trstat (transmit/receive status) bit to see that transmission has stopped and remains idle. if this bit = 1, it means that the can module is accessing the message slot, so you need to wait until the bit is cleared. (3) setting transmit data set the transmit id and transmit data in the message slot. (4) setting the extended id register set the corresponding bit of the extended id register to 0 when you want to transmit the data as a standard frame or 1 when you want to transmit the data as an extended frame. (5) setting the can message slot control register write h'80 (note) to the can message slot control register to set the tr (transmit request) bit to 1. note: when you are transmitting a data frame, always write h'80 to this register. can module 13.5 transmitting data frames
13 13-60 ver.0.10 figure 13.5.1 data frame transmit procedure can module 13.5 transmitting data frames data frame transmit procedure initialize can message slot control register set id and data in message slot set extended id register set can message slot control register settings completed write h'00 standard id or extended id write h'80 (transmit request) read can message slot control register trstat bit = 0 yes no verify that transmission is idle
13 13-61 ver.0.10 13.5.2 data frame transmit operation the following describes data frame transmit operation. the operations described below are automatically performed in hardware. (1) selecting a transmit frame the can module checks slots which have transmit requests (including remote frame transmit slots) every intermission to determine the frame to transmit. if there are multiple transmit slots, frames are transmitted in order of slot numbers beginning with the smallest. (2) transmitting a data frame after determining the transmit slot, the can module sets the corresponding can message slot control register's trstat (transmit/receive status) bit to 1, thereby starting transmission. (3) if the can module lost bus arbitration or a can bus error occurs if the can module lost bus arbitration or a can bus error occurs while transmitting, the can module clears the can message slot control register's trstat (transmit/receive status) bit to 0. if the can module requested a transmit abort, the transmit abort is accepted and writing to the message slot is enabled. (4) completion of data frame transmission when data frame transmission is completed, the can message slot control register's trfin (transmit/receive finished) bit and the can slot interrupt status register are set to 1. also, a time stamp count value at the time transmission was completed is written to the can message slot time stamp (c0mslntsp), and the transmit operation is thereby completed. if the can slot interrupt has been enabled, an interrupt request is generated at completion of transmit operation. the slot which has had transmission completed goes to an inactive state and remains inactive (neither transmit nor receive) until it is newly set in software. can module 13.5 transmitting data frames
13 13-62 ver.0.10 figure 13.5.2 operation of the can message slot control register when transmitting data frames 13.5.3 transmit abort function the transmit abort function is used to cancel a transmit request that has once been set. this is accomplished by writing h'0f to the can message slot control register for the slot concerned. when transmit abort is accepted, the can module clears the can message slot control register's trstat (transmit/receive status) bit to 0, allowing for data to be written to the message slot. the following shows conditions under which transmit abort is accepted: [conditions] ? when the target message is waiting for transmission ? when a can bus error occurs during transmission ? when the can module lost bus arbitration can module 13.5 transmitting data frames b'1000 0010 b'0000 0001 (note) b'1000 0001 b'0000 0000 (note) b'1000 0000 write h'80 transmit aborted transmit request accepted note: when in this state, data can be written to the message slot. transmit aborted lost bus arbitration can bus error occurred transmit request accepted transmit aborted transmit completed transmit aborted transmit completed waiting for transmission b'0000 0010 lost bus arbitration can bus error occurred
13 13-63 ver.0.10 13.6 receiving data frames 13.6.1 data frame receive procedure the following describes the procedure for receiving data frames. (1) initializing the can message slot control register initialize the can message slot control register for the slot in which you want to receive by writing h'00 to the register. (2) confirming that reception is idle read the can message slot control register after being initialized and check the trstat (transmit/receive status) bit to see that reception has stopped and remains idle. if this bit = 1, it means that the can module is accessing the message slot, so you need to wait until the bit is cleared. (3) setting the receive id set the id you want to receive in the message slot. (4) setting the extended id register set the corresponding bit of the extended id register to 0 when you want to receive a standard frame or 1 when you want to receive an extended frame. (5) setting the can message slot control register write h'40 to the can message slot control register to set the rr (receive request) bit to 1. can module 13.6 receiving data frames
13 13-64 ver.0.10 figure 13.6.1 data frame receive procedure can module 13.6 receiving data frames yes no data frame receive procedure initialize can message slot control register set id in message slot set extended id register set can message slot control register settings completed read can message slot control register trstat bit = 0 write h'00 standard id or extended id write h'40 (receive request) verify that reception is idle
13 13-65 ver.0.10 13.6.2 data frame receive operation the following describes data frame receive operation. the operations described below are automatically performed in hardware. (1) acceptance filtering when the can module finished receiving data, it starts searching for the slot that satisfies conditions for receiving the received message sequentially from slot 0 (up to slot 15). the following shows receive conditions for slots that have been set for data frame reception. [conditions] ? the receive frame is a data frame. ? the receive id and the slot id are identical, assuming the id mask register bits set to 0 are "don't care bits." ? the standard and extended frame types are the same. note: in basiccan mode, slots 14 and 15 while being set for data frame reception can also receive remote frames. (2) when receive conditions are met when receive conditions in (1) above are met, the can module sets the can message slot control register's trstat (transmit/receive status) and trfin (transmit/receive finished) bits to 1 while at the same time writing the received data to the message slot. if the trfin (transmit/receive finished) bit is already 1, the can module also sets the ml (message lost) bit to 1, indicating that the message slot has been overwritten. the message slot has its id field and dlc field both overwritten and an indeterminate value written in its unused area (e.g., extended id field for standard frame reception and an unused data field). furthermore, a time stamp count value at the time the message was received is written to the can message slot time stamp (c0mslntsp) along with the received data. when the can module finished writing to the message slot, it sets the can slot interrupt status bit to 1. if the interrupt for the slot has been enabled, an interrupt request is generated, and the slot goes to a wait state for the next reception. (3) when receive conditions are not met the received frame is discarded, and the can module goes to the next transmit/receive operation without writing to the message slot. can module 13.6 receiving data frames
13 13-66 ver.0.10 figure 13.6.2 operation of the can message slot control register when receiving data frames can module 13.6 receiving data frames b'0100 0011 b'0000 0001 b'0100 0001 b'0000 0000 b'0100 0000 clear receive request receive request set store received data clear receive request store received data clear receive request finished storing received data finished storing received data clear receive request b'0000 0011 b'0100 0111 store received data b'0100 0101 finished storing received data clear receive request b'0000 0111 store received data clear receive request clear receive request b'0000 0101 finished storing received data clear receive request clear receive request store received data wait for receive data wait for receive data finished storing received data finished storing received data cpu read cpu read
13 13-67 ver.0.10 13.6.3 reading out received data frames the following describes the procedure for reading out received data frames from the slot. (1) clearing the trfin (transmit/receive finished) bit write h'4e, h'40 or h'00 to the can message control register (c0mslncnt) to clear the trfin bit to 0. after this write, the slot operates as follows: value written to slot operation after write c0mslncnt h'4e operates as a data frame receive slot. overwrite can be verified by ml bit. h'40 operates as a data frame receive slot. overwrite cannot be verified by ml bit. h'00 the slot stops transmit/receive operation. note 1: if message-lost check by the ml bit is needed, write h'4e to the c0mslncnt register as you clear the trfin bit. note 2: if you clear the trfin bit by writing h'4e, h'40 or h'00, it is possible that new data will be stored in the slot while still reading a message from the slot. (2) reading out from the message slot read out a message from the message slot. (3) checking the trfin (transmit/receive finished) bit read the can message control register to check the trfin (transmit/receive finished) bit. when trfin (transmit/receive finished) bit = 1 it means that new data was stored in the slot while still reading out from the slot in (2). in this case, the data read out in (2) may contain an indeterminate value. therefore, reexecute beginning with clearing of the trfin (transmit/receive finished) bit in (1). when trfin (transmit/receive finished) bit = 0 it means that the can module finished reading out from the slot normally. can module 13.6 receiving data frames
13 13-68 ver.0.10 figure 13.6.3 procedure for reading out received data can module 13.6 receiving data frames reading out received data clear trfin bit to 0 read out from message slot finished reading out received data read can message slot control register trfin bit = 0 yes no
13 13-69 ver.0.10 13.7 transmitting remote frames 13.7.1 remote frame transmit procedure the following describes the procedure for transmitting remote frames. (1) initializing the can message slot control register initialize the can message slot control register for the slot in which you want to transmit by writing h'00 to the register. (2) confirming that transmission is idle read the can message slot control register after being initialized and check the trstat (transmit/receive status) bit to see that transmission has stopped and remains idle. if this bit = 1, it means that the can module is accessing the message slot, so you need to wait until the bit is cleared. (3) setting transmit id set the id to be transmitted in the message slot. (4) setting the extended id register set the corresponding bit of the extended id register to 0 when you want to transmit the frame as a standard frame or 1 when you want to transmit the frame as an extended frame. (5) setting the can message slot control register write h'a0 to the can message slot control register to set the tr (transmit request) and rm (remote) bits to 1. can module 13.7 transmitting remote frames
13 13-70 ver.0.10 figure 13.7.1 remote frame transmit procedure can module 13.7 transmitting remote frames remote frame transmit procedure initialize can message slot control register set id in message slot set extended id register set can message slot control register settings completed write h'00 standard id or extended id write h'a0 (transmit request, remote) read can message slot control register trstat bit = 0 yes no verify that transmission is idle
13 13-71 ver.0.10 13.7.2 remote frame transmit operation the following describes remote frame transmit operation. the operations described below are automatically performed in hardware. (1) setting the ra (remote active) bit at the same time h'a0 (transmit request, remote) is written to the can message slot control register, the ra (remote active) bit is set to 1, indicating that the corresponding slot is to handle remote frames. (2) selecting a transmit frame the can module checks slots which have transmit requests (including data frame transmit slots) every intermission to determine the frame to transmit. if there are multiple transmit slots, frames are transmitted in order of slot numbers beginning with the smallest. (3) transmitting a remote frame after determining the transmit slot, the can module sets the corresponding can message slot control register's trstat (transmit/receive status) bit to 1, thereby starting transmission. (4) if the can module lost bus arbitration or a can bus error occurs if the can module lost bus arbitration or a can bus error occurs while transmitting, the can module clears the can message slot control register's trstat (transmit/receive status) bit to 0. if the can module requested a transmit abort, the transmit abort is accepted and writing to the message slot is enabled. (5) completion of remote frame transmission when remote frame transmission is completed, a time stamp count value at the time transmission was completed is written to the can message slot time stamp (c0mslntsp) and the can message slot control register's ra (remote active) bit is cleared to 0. also, the can slot interrupt status bit is set to 1 by completion of transmission, but the can message slot control register's trfin (transmit/receive finished) bit is not set to 1. if the can slot interrupt has been enabled, an interrupt request is generated upon completion of transmission. (6) receiving a data frame when remote frame transmission is completed, the slot automatically starts functioning as a data frame receive slot. (7) acceptance filtering when the can module finished receiving data, it starts searching for the slot that satisfies conditions for receiving the received message sequentially from slot 0 (up to slot 15). can module 13.7 transmitting remote frames
13 13-72 ver.0.10 the following shows receive conditions for slots that have been set for data frame reception. [conditions] ? the receive frame is a data frame. ? the receive id and the slot id are identical, assuming the id mask register bits set to 0 are "don't care bit." ? the standard and extended frame types are the same. note: in basiccan mode, slots 14 and 15 cannot be used as transmit slots. (8) when receive conditions are met when receive conditions in (7) above are met, the can module sets the can message slot control register's trstat (transmit/receive status) and trfin (transmit/receive finished) bits to 1 while at the same time writing the received data to the message slot. if the trfin (transmit/receive finished) bit is already 1, the can module also sets the ml (message lost) bit to 1, indicating that the message slot has been overwritten. the message slot has its id field and dlc field both overwritten and an indeterminate value written in its unused area (e.g., extended id field for standard frame reception and an unused data field). furthermore, a time stamp count value at the time the message was received is written to the can message slot time stamp (c0mslntsp) along with the received data. when the can module finished writing to the message slot, it sets the can slot interrupt status bit to 1. if the interrupt for the slot has been enabled, an interrupt request is generated, and the slot goes to a wait state for the next reception. note: if the can module received a data frame before transmitting a remote frame, it stores the data frame in the slot and does not transmit the data frame. (9) when receive conditions are not met the received frame is discarded, and the can module goes to the next transmit/receive operation without writing to the message slot. can module 13.7 transmitting remote frames
13 13-73 ver.0.10 figure 13.7.2 operation of the can message slot control register when transmitting remote frames can module 13.7 transmitting remote frames b'0000 0000 b'0000 0000 store received data b'0000 1010 b'1010 0011 store received data clear transmit request b'0000 0011 b'0000 0001 finished storing received data finished transmitting remote frame cpu read b'1010 0101 b'1010 1000 b'1010 1010 finished storing received data clear receive request store received data clear receive request finished storing received data b'1010 0001 b'1010 0111 b'0000 0111 b'0000 0101 finished storing received data clear receive request store received data clear receive request finished storing received data finished transmitting remote frame b'1010 0000 wait for receive data b'1010 1011 b'0000 1011 b'0000 0001 finished storing received data b'0000 1000 can bus error occurs lost bus arbitration can bus error occurs clear transmit request store received data store received data wait for receive data clear transmit request finished storing received data
13 13-74 ver.0.10 13.7.3 reading out received data frames when set for remote frame transmission the following describes the procedure for reading out received data frames from the slot when it is set for remote frame transmission. (1) clearing the trfin (transmit/receive finished) bit write h'ae or h'00 to the can message control register (c0mslncnt) to clear the trfin bit to 0. after this write, the slot operates as follows: value written to slot operation after write c0mslncnt h'ae operates as a data frame receive slot. overwrite can be verified by ml bit. h'00 the slot stops transmit/receive operation. note 1: if message-lost check by the ml bit is needed, write h'ae to the c0mslncnt register as you clear the trfin bit. note 2: if you clear the trfin bit by writing h'ae or h'00, it is possible that new data will be stored in the slot while still reading a message from the slot. note 3: the received data frame cannot be read out by writing h'a0 to the register. if you clear the trfin bit by writing h'a0, the slot performs remote frame transmit operation. (2) reading out from the message slot read out a message from the message slot. (3) checking the trfin (transmit/receive finished) bit read the can message control register to check the trfin (transmit/receive finished) bit. when trfin (transmit/receive finished) bit = 1 it means that new data was stored in the slot while still reading out from the slot in (2). in this case, the data read out in (2) may contain an indeterminate value. therefore, reexecute beginning with clearing of the trfin (transmit/receive finished) bit in (1). when trfin (transmit/receive finished) bit = 0 it means that the can module finished reading out from the slot normally. can module 13.7 transmitting remote frames
13 13-75 ver.0.10 figure 13.7.3 procedure for reading out received data when set for remote frame transmission can module 13.7 transmitting remote frames reading out received data clear trfin bit to 0 read out from message slot finished reading out received data read can message slot control register trfin bit = 0 yes no
13 13-76 ver.0.10 13.8 receiving remote frames 13.8.1 remote frame receive procedure the following describes the procedure for receiving remote frames. (1) initializing the can message slot control register initialize the can message slot control register for the slot in which you want to receive by writing h'00 to the register. (2) confirming that reception is idle read the can message slot control register after being initialized and check the trstat (transmit/receive status) bit to see that reception has stopped and remains idle. if this bit = 1, it means that the can module is accessing the message slot, so you need to wait until the bit is cleared. (3) setting the receive id set the id you want to receive in the message slot. (4) setting the extended id register set the corresponding bit of the extended id register to 0 when you want to receive a standard frame or 1 when you want to receive an extended frame. (5) setting the can message slot control register when automatic response (data frame transmission) for remote frame reception is desired write h'60 to the can message slot control register to set the rr (receive request) and rm (remote) bits to 1. when automatic response (data frame transmission) for remote frame reception is not needed write h'70 to the can message slot control register to set the rr (receive request), rm (remote), and rl (automatic response enable) bits to 1. note: in basiccan mode, slots 14 and 15, although capable of receiving remote frames, cannot automatically respond to remote frame reception. can module 13.8 receiving remote frames
13 13-77 ver.0.10 can module 13.8 receiving remote frames figure 13.8.1 remote frame receive procedure remote frame reception procedure initialize can message slot control register set id in message slot set extended id register set can message slot control register settings completed write h'00 standard id or extended id write h'60 (receive request, remote, automatic response enable) write h'70 (receive request, remote, automatic response disable) read can message slot control register trstat bit = 0 yes no verify that reception is idle
13 13-78 ver.0.10 can module 13.8 receiving remote frames 13.8.2 remote frame receive operation the following describes remote frame receive operation. the operations described below are automatically performed in hardware. (1) setting the ra (remote active) bit when h'60 (transmit request, remote) or h'70 (transmit request, remote, automatic response disable) is written to the can message slot control register, the ra (remote active) bit is set to 1, indicating that the corresponding slot is to handle remote frames. (2) acceptance filtering when the can module finished receiving data, it starts searching for the slot that satisfies conditions for receiving the received message sequentially from slot 0 (up to slot 15). the following shows receive conditions for slots that have been set for data frame reception. [conditions] ? the receive frame is a remote frame. ? the receive id and the slot id are identical, assuming the id mask register bits set to 0 are "don't care bit." ? the standard and extended frame types are the same. (3) when receive conditions are met when receive conditions in (2) above are met, the can module sets the can message slot control register's trstat (transmit/receive status) and trfin (transmit/receive finished) bits to 1 while at the same time writing the received data to the message slot. furthermore, a time stamp count value at the time the message was received is written to the can message slot time stamp (c0mslntsp) along with the received data. when the can module finished writing to the message slot, it sets the can slot interrupt status bit to 1. if the interrupt for the slot has been enabled, an interrupt request is generated. note 1: the id field and dlc value are written to the message slot. note 2: when receiving standard format frames, an indeterminate value is written to the extended id area. note 3: the data field is not accessed for write. note 4: the ra and trfin bits are cleared to 0 after writing the remote frame received data. (4) when receive conditions are not met the received frame is discarded, and the can module waits for the next receive frame. no data is written to the message slot.
13 13-79 ver.0.10 can module 13.8 receiving remote frames (5) operation after receiving a remote frame the operation performed after receiving a remote frame differs depending on how automatic response is set. when automatic response is disabled the slot which finished receiving goes to an inactive state and remains inactive (neither transmit nor receive) until it is newly set in software. when automatic response is enabled after receiving a remote frame, the slot automatically changes to a data frame transmit slot and performs the transmit operation described below. in this case, the transmitted data conforms to the id and dlc of the received remote frame. selecting a transmit frame the can module checks slots which have transmit requests (including remote frame transmit slots) every intermission to determine the frame to transmit. if there are multiple transmit slots, frames are transmitted in order of slot numbers beginning with the smallest. transmitting a data frame after determining the transmit slot, the can module sets the corresponding can message slot control register's trstat (transmit/receive status) bit to 1, thereby starting transmission. if the can module failed to gain control of the bus or a can bus error occurs if the can module failed to gain control of the bus or a can bus error occurs while transmitting, the can module clears the can message slot control register's trstat (transmit/receive status) bit to 0. if the can module requested a transmit abort, the transmit abort is accepted and writing to the message slot is enabled. completion of data frame transmission when data frame transmission is completed, the can message slot control register's trfin (transmit/receive finished) bit and the can slot interrupt status register are set to 1. also, a time stamp count value at the time transmission was completed is written to the can message slot time stamp (c0mslntsp), and the transmit operation is thereby completed. if the can slot interrupt has been enabled, an interrupt request is generated at completion of transmit operation. the slot which has had transmission completed goes to an inactive state and remains inactive (neither transmit nor receive) until it is newly set in software.
13 13-80 ver.0.10 can module 13.8 receiving remote frames figure 13.8.2 operation of the can message slot control register when receiving remote frames b'0000 0000 b'0000 0000 clear receive request b'0000 1010 b'0110 0010 store received data clear receive request b'0000 0010 b'0000 0001 finished storing received data b'0110 1000 b'0110 1010 finished storing received data clear receive request b'0110 0001 b'0110 0000 b'0111 1000 b'0000 1010 b'0000 0000 wait for receive data transmit data frame clear receive request finished transmitting data frame finished transmitting data frame transmit data frame finished storing received data store received data b'0111 1010 b'0111 0000 finished storing received data finished storing received data clear receive request store received data clear receive request write h'60 (automatic response enable) write h'70 (automatic response enable) store received data
chapter 14 chapter 14 real-time debugger (rtd) 14.1 outline of the real-time debugger (rtd) 14.2 pin function of the rtd 14.3 functional description of the rtd 14.4 typical connection with the host
14 14-2 ver.0.10 14.1 outline of the real-time debugger (rtd) the real-time debugger (rtd) is a serial i/o through which to read or write to the internal ram's entire area using commands from outside the microprocessor. because data transfers between the rtd and internal ram are performed using an internal dedicated bus independently of the m32r cpu, operation can be controlled without having the stop the m32r cpu. table 14.1.1 outline of the real-time debugger (rtd) item content transfer method clock-synchronized serial i/o generation of transfer clock generated by external host ram access area entire area of internal ram (controlled by a16-a29) transmit/receive data length 32 bits (fixed) bit transfer sequence lsb first maximum transfer rate 2 mbits/second input/output pins 4 lines (rtdtxd, rtdrxd, rtdack, rtdclk) number of commands following five functions ? monitors continuously ? outputs real-time ram contents ? forcibly rewrites ram contents (with verify) ? recovers from runaway ? requests rtd interrupt real-time debugger (rtd) 14.1 outline of the real-time debugger (rtd) figure 14.1.1 block diagram of the real-time debugger (rtd) control circuit command data rtd control circuit entire ram area cpu address data bus switching circuit rtdclk rtdack rtdtxd rtdrxd address data data address
14 14-3 ver.0.10 real-time debugger (rtd) 14.2 pin function of the rtd 14.2 pin function of the rtd pin functions of the rtd are shown below. table 14.2.1 pin function of the rtd pin name type function rtdtxd output rtd serial data output rtdrxd input rtd serial data input rtdack output outputs a low-level pulse synchronously with the beginning clock edge of the output data word. the width of the low-level pulse thus output indicates the type of instruction/data that the rtd received. 1 clock period : ver (continuous monitor) command 1 clock period : vei (rtd interrupt request) command 2 clock periods : rdr (real-time ram content output) command 3 clock periods : wrr (ram content forcible rewrite) command or the data to rewrite 4 clock periods or more : rcv (recover from runaway) command rtdclk input rtd transfer clock input
14 14-4 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd 14.3 functional description of the rtd 14.3.1 outline of rtd operation operation of the rtd is specified by a command entered from devices external to the chip. a command is specified in bits 16-19(note 1) of the rtd receive data. table 14.3.1 rtd commands rtd receive data command mnemonic rtd function b19 b18 b17 b16 0 0 0 0 ver (verify) continuous monitor 0100 0101 0 1 1 0 vei (verify interrupt request) rtd interrupt request 0 0 1 0 rdr (read ram) real-time ram content output 0 0 1 1 wrr (write ram) ram content forcibly rewrite (with verify) 1 1 1 1 rcv (recover) recover from runaway (note 2, note 3) 0 0 0 1 system reserved (use inhibited) - (note 1) note 1 : bit 19 of rtd receive data is not actually stored in the command register and except for the rcv command, is handled as "don't care" bit. (bits 16-18 are effective for the command specified.) note 2 : the rcv command must always be transmitted twice in succession. note 3 : for the rcv command, all bits, not just bits 16-19, (i.e., bits 0-15 and bits 20-31) must be set to 1.
14 14-5 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd 14.3.2 operation of rdr (real-time ram content output) when the rdr (real-time ram content output) command is issued, the rtd is made possible to transfer the contents of the internal ram to external devices without causing the cpu's internal bus to stop. because the rtd reads data from the internal ram while no transfers are being performed between the cpu and internal ram, no extra load is levied on the cpu. the address to be read from the internal ram can only be specified on 32-bit word boundaries. (the two low-order address bits specified by a command are ignored.) note also that data are read out in units of 32 bits as transferred from the internal ram to an external device. figure 14.3.1 rdr command data format figure 14.3.2 operation of the rdr command note : x = don't care (however, if issued immediately after the rcv command, bits 20-31 must all be set to 1.) note : (an) = specified address d (an) = data at specified address (an) 31 x 0 0 1 0 19 18 17 16 x 15 x 14 13 12 1 a16 0 x 20 a17 a28 a29 ????? ????? command ( rdr ) specified address ????? ???? rtdrxd (msb side) (lsb side) 32 clock periods 32 clock periods 32 clock periods 32 clock periods rdr (a1) rdr (a2) rdr (a3) d (a1) d (a2) 2 clock periods rtdclk rtdrxd rtdtxd rtdack ????? ?????
14 14-6 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd figure 14.3.3 read data transfer format note : the read data is transferred lsb-first. 31 d31 1 d0 0 d30 30 d1 read data (note) rtdtxd ????????????????? (msb side) (lsb side) ?????????????????
14 14-7 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd 14.3.3 operation of wrr (ram content forcible rewrite) when the wrr (ram content forcible rewrite) command is issued, the rtd forcibly rewrites the contents of the internal ram without causing the cpu's internal bus to stop. because the rtd writes data to the internal ram while no transfers are being performed between the cpu and internal ram, no extra load is levied on the cpu. the address to be read from the internal ram can only be specified on 32-bit word boundaries. (the two low-order address bits specified by a command are ignored.) note also that data are written to the internal ram in units of 32 bits. the external host should transmit the command and address in the first frame and then the write data in the second frame. the timing at which the rtd writes to the internal ram occurs in the third frame after receiving the write data. figure 14.3.4 wrr command data format note 1: x = don't care (however, if issued immediately after the rcv command, bits 20-31 must all be set to 1.) note 2 : the specified address and write data are transferred lsb-first. 31 x 0 0 1 1 19 18 17 16 x 15 x 14 13 12 1 a16 0 x 20 a17 a28 a29 ????? ????? command (wrr) specified address ????? ???? rtdrxd (msb side) (lsb side) 31 d31 1 d0 0 d30 30 d1 write data (note) ????????????????? (msb side) (lsb side) ????????????????? rtdrxd a) first frame b) second frame
14 14-8 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd figure 14.3.5 operation of the wrr command the rtd reads out data from the specified address before writing to the internal ram and again reads out from the same address immediately after writing to the internal ram (this helps to verify the data written to the internal ram). the read data is output at the timing shown below. note : (an) = specified address d (an) = data at specified address (an) d (a1) verify value after write wrr (a1) (a1) write data rtdclk rtdrxd rtdtxd rtdack wrr (a2) (a2) write data d (a1) read value before write 32 clock periods 32 clock periods 32 clock periods 32 clock periods 3 clock periods ?????
14 14-9 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd 14.3.4 operation of ver (continuous monitor) when the ver (continuous monitor) command is issued, the rtd outputs data from the address that has been accessed by the instruction (either read or write) immediately before receiving the ver command. figure 14.3.6 ver (continuous monitor) command data format figure 14.3.7 operation of the ver (continuous monitor) command note : x = don't care (however, if issued immediately after the rcv command, bits 20-31 must all be set to 1.) note 1 : wrr command can also be used. note 2 : (an) = specified address d (an) = data at specified address (an) 31 x0000 19 18 17 16 x 15 0 x 20 ????????? ????? ????? ???????? rtdrxd (msb side) (lsb side) x command (ver) rdr (a1) ver rtdclk rtdrxd rtdtxd rtdack d (a1) read value (note 2) d (a1) latest read value (note 1) ver 32 clock periods 32 clock periods 32 clock periods 32 clock periods 2 clock periods ????? ?????
14 14-10 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd 14.3.5 operation of vei (interrupt request) when the vei (interrupt request) command is issued, the rtd outputs data from the address that has been accessed by the instruction (either read or write) immediately before receiving the vei command. figure 14.3.8 vei (interrupt request) command data format figure 14.3.9 operation of the vei (interrupt request) command note : x = don't care (however, if issued immediately after the rcv command, bits 20-31 must all be set to 1.) note 1 : wrr command can also be used. note 2 : (an) = specified address d (an) = data at specified address (an) 31 x 0110 19 18 17 16 x 15 0 x 20 ????????? ????? ????? ???????? rtdrxd (msb side) (lsb side) x vei (interrupt request generation) command (note) (note) rtd interrupt rdr (a1) vei rtdclk rtdrxd rtdtxd rtdack d (a1) read value (note 2) (note 1) 32 clock periods 32 clock periods 32 clock periods 32 clock periods 2 clock periods ????? ????? d (a1) read value (note 2) rtd interrupt request
14 14-11 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd 14.3.6 operation of rcv (recover from runaway) when the rtd runs out of control, the rcv (recover from runway) command can be issued to forcibly recover from the runaway condition without having to reset the system. the rcv command must always be issued twice in succession. also, any command issued subsequently after the rcv command must have its bits 20-31 all set to 1. figure 14.3.10 rcv command data format note : all of 32 data bits are 1's. the rcv command must always be issued twice in succession. note : the next command following the rcv command must have its bits 20-31 all set to 1. figure 14.3.11 operation of the rcv command 31 11111 19 18 17 16 1 15 0 1 20 ????????? ????? ????? ???????? rtdrxd (msb side) (lsb side) 1 command (rcv) (note) (note) rcv rcv command stored here rtdclk rtdrxd rtdtxd rtdack rcv bits 20-31 d (a1) indeterminate data during runway condition indeterminate value during runway condition next command following the rcv command 1 ?? 1 rdr (a1) 32 clock periods 32 clock periods 32 clock periods 32 clock periods 2 clock periods ????? 2 clock periods
14 14-12 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd figure 14.3.12 method for setting addresses in real-time debugger 14.3.7 method to set a specified address when using the rtd when using the real-time debugger (rtd), you can set low-order 16-bit addresses of the internal ram area. because the internal ram area is located in a 48 kb area ranging from h'0080 4000 to h'0080 ffff, you can set low-order 16-bit addresses of that area. however, access to any locations other than the area where the ram resides is inhibited. note also that two least significant address bits, a31 and a30, are always 0's because data are read and written to the internal ram in a fixed length of 32 bits. sfr 16kb h'0080 0000 h'0080 4000 memory map h'0080 ffff xx a29 - a16 h'0080 4000~h'0080 ffff ?? ram area only can be specified
14 14-13 ver.0.10 real-time debugger (rtd) 14.3 functional description of the rtd figure 14.3.13 command transfer to the rtd after system reset note : (an) = specified address d (an) = data at specified address (an) 14.3.8 resetting the rtd the rtd is reset by applying a system rest (i.e., by entering the reset signal). the status of the rtd related output pins after a system reset are shown below. table 14.3.2 rtd pin state after system reset pin name state rtdack high-level output rtdtxd high-level output the first command transfer to the rtd after it was reset is initiated by transferring data to the rtdrxd pin synchronously with falling edges of rtdclk. don't care rdr (a1) rtdclk rtdrxd rtdtxd rtdack reset system reset "h" rdr (a2) 0000 0000 0000 0000 d (a2) "h" d (a1) 32 clock periods 32 clock periods 32 clock periods 32 clock periods ?????
14 14-14 ver.0.10 real-time debugger (rtd) 14.4 typical connection with the host figure 14.4.1 connecting the rtd and host note : in this example, the rtdack level is checked between transfer frames. 14.4 typical connection with the host the host uses a serial synchronous interface to transfer data. the clock for synchronous is generated by the host. an example for connecting the rtd and host is shown below. rtdrxd rtdtxd rtdclk rtdack m32r/e host microprocessor rxd txd sclk port (note)
14 14-15 ver.0.10 real-time debugger (rtd) 14.4 typical connection with the host the rtd communication for a fixed length of 32 bits per frame generally is performed in four operations sending 8 bits at a time, because most serial interfaces transfer data in units of 8 bits. the rtdack signal is used to verify that communication is performed normally. after transmitting a command, the rtdack signal is pulled low, making it possible to verify the communication status. when issuing the ver command, the rtdack signal goes low for only one clock period. therefore, after sending 32 bits in one frame, turn off rtdclk output and check whether rtdack is low. if rtdack is low, you know that the rtd is communicating normally. if you want to identify the type of transmitted command by the width of rtdack, use the 32170's internal measurement timer (to count rtdclk pulses while rtdack is low) or create a dedicated circuit. figure 14.4.2 typical operation for communication with the host (when issuing ver command) transfer of next frame (8 bits) check the rtdack signal l level. rtdclk rtdrxd rtdtxd rtdack transfer of 1 frame (32 bits) 12 ????? (8 bits) (8 bits)
14 14-16 ver.0.10 real-time debugger (rtd) 14.4 typical connection with the host * this is a blank page.*
chapter 15 chapter 15 external bus interface 15.1 external bus interface related signals 15.2 read/write operations 15.3 bus arbitration 15.4 typical connection of external extension memory
15 15-2 ver.0.10 external bus interface 15.1 external bus interface related signals 15.1 external bus interface related signals the 32170 comes with external bus interface related signals shown below. these signals can be used in external extension mode or processor mode. (1) address the 32170 outputs a 20-bit address (a11-a30) for addressing any location in 2 mbytes of space. ___ the least significant a31 is not output, and in external write cycles, the 32170 outputs bhw and ___ blw signals to indicate the valid byte position at which to write on the 16-bit data bus. in read cycles, the 32170 reads data always in 16 bits, transferring only the data read from the valid byte position of the bus. ___ ___ (2) chip select (cs0, cs1) ___ ___ these signals are output in external extension mode or processor mode, with cs0 and cs1 ___ specifying an extended external area of 2 mbytes each. the cs0 signal points to a 2-mbyte area in processor mode or a 1-mbyte area in external extension mode. (for details, refer to chapter 3, "address space.") __ (3) read strobe (rd) output during external read cycle, this signal indicates the timing at which to read data from the bus. this signal is driven high when writing to the bus or accessing the internal function. ___ ___ (4) byte high write/byte high enable (bhw / bhe) the pin function changes depending on the bus mode control register (busmodc). ___ when busmod = 0 and this signal is byte high write (bhw), during external write access it indicates that the upper byte (db0-db7) of the data bus is the valid data to transfer. during external read and when accessing the internal function it outputs a high. ___ when busmod = 1 and this signal is byte high enable (bhe), during external access it indicates that the upper byte (db0-db7) of the data bus is the valid data to transfer. when accessing the internal function, it outputs a high. ___ ___ (5) byte low write/byte low enable (blw / ble) the pin function changes depending on the bus mode control register (busmodc). ___ when busmod = 0 and this signal is byte low write (blw), during external write access it indicates that the lower byte (db8-db15) of the data bus is the valid data to transfer. during external read cycle, it outputs a high. ___ when busmod = 1 and this signal is byte low enable (ble), during external access it indicates that the lower byte (db8-db15) of the data bus is the valid data to transfer. when accessing the internal function, it outputs a high.
15 15-3 ver.0.10 external bus interface 15.1 external bus interface related signals (6) data bus (db0 - db15) this is the 16-bit data bus used to access external devices. __ (7) system clock/write (bclk / wr) the pin function changes depending on the bus mode control register (busmodc). when busmod = 0 and this signal is system clock (bclk), it outputs the system clock necessary to synchronize operations in an external system. when the cpu clock = 40 mhz, a 20 mhz clock is output from bclk. when not using the bclk/wr function, this pin can be used as p70 by setting the p7 operation mode register p70mod bit to 0. __ when busmod = 1 and this signal is write (wr), during external write access it indicates the valid data on the data bus to transfer. during external read cycle and when accessing the internal function, it outputs a high. ____ (8) wait (wait) ____ when the 32170 started an external bus cycle, it automatically inserts wait cycles while the wait signal is asserted. for details, refer to chapter 16, "wait controller." when not using the wait function, this pin can be used as p71 by setting the p7 operation mode register p71mod bit to 0. note that the 32170 always inserts one or more wait cycles for external access. therefore, the shortest time in which an external device can be accessed is one wait cycle (2 bclk periods). ____ ____ (9) hold control (hreq, hack) the hold state refers to a state in which the 32170 has stopped bus access and bus interface related pins are tristated (high impedance). while the 32170 is in a hold state, any bus master external to the chip can use the system bus to transfer data. ____ the 32170 is placed in a hold state by pulling the hreq pin input low. while the 32170 remains in ____ a hold state after accepting the hold request and during a transition to the hold state, the hack pin outputs a low-level signal. to exit from the hold state and return to normal operating state, release ____ the hreq signal back high. when not using the hreq and hack functions, these pins can be used as p72 and p7 by setting the p73 operation mode register p72mod and p73mod bits to 0. the status of each 32170 pin during hold are shown below. table 15.1.1 pin state during hold period pin name pin state or operation ___ ___ __ ___ ___ ___ ___ __ a11-a30, db0-db15, cs0, cs1, rd, bhw, blw, bhe, ble, wr high impedance ____ hack outputs a low other pins (e.g., ports and timer output) normal operation
15 15-4 ver.0.10 external bus interface 15.1 external bus interface related signals (10) port p7 operation mode register (p7mod) ____ ____ ____ the wait, hreq, and hack pins are shared with p71, p72, and p73, respectively. the port p7 operation mode register is used to select the function of port p7. configuration of this register is shown below. n p7 operation mode register d8 9 1011121314d15 p70mod p71mod p72mod p73mod p74mod p75mod p76mod p77mod d bit name function r w 8 p70mod 0 : p70 (port p70 operation mode) __ 1 : bclk / wr 9 p71mod 0 : p71 (port p71 operation mode) ____ 1 : wait 10 p72mod 0 : p72 (port p72 operation mode) ____ 1 : hreq 11 p73mod 0 : p73 (port p73 operation mode) ____ 1 : hack 12 p74mod 0 : p74 (port p74 operation mode) 1 : rtdtxd 13 p75mod 0 : p75 (port p75 operation mode) 1 : rtdrxd 14 p76mod 0 : p76 (port p76 operation mode) 1 : rtdack 15 p77mod 0 : p77 (port p77 operation mode) 1 : rtdclk
15 15-5 ver.0.10 external bus interface 15.1 external bus interface related signals (11) bus mode control register (busmodc) the 32170 contains a function to switch between two external bus modes. n bus mode control register (busmodc) d8 9 1011121314d15 busmod d bit name function r w 8 - 15 no functions assigned 0 15 busmod 0: wr signal separate mode (bus mode control) 1: byte enable separate mode this register is used to facilitate memory connection in processor mode and external extension mode. when bus mode control register (busmod) = 0, the wr signal is output separately for each byte __ ___ ___ ____ ____ area. signals rd, bhw, blw, bclk, and wait can be used. for memory connection in boot mode, the bus mode control register has no effect and the interface operates under conditions where bus mode control register (busmod) = 0. when bus mode control register (busmod) = 1, the byte enable signal is output separately for __ ___ ___ __ ____ each byte area. signals rd, bhw, ble, wr, and wait can be used. for wait control circuit configuration, because bclk is not output, external timing control is required. figure 15.1.1 pin function when bus modes are changed cs0, cs1 db0 - db15 wait rd bhw blw a11 - a30 cs0, cs1 db0 - db15 wait rd wr bhe ble a11 - a30 bclk busmod = 0 busmod = 1
15 15-6 ver.0.10 external bus interface 15.2 read/write operations 15.2 read/write operations (1) when bus mode control register = 0 ___ external read/write operations are performed using the address bus, data bus, and signals cs0, ___ __ ___ ___ ____ ____ cs1, rd, bhw, blw, wait, and bclk. in external read cycle, the rd signal is low while bhw and blw both are high, reading data from only the valid byte position of the bus. in external write cycle, bhw or blw output for the byte position to which to write is pulled low as data is written to the bus. ____ when an external bus cycle starts, wait cycles are inserted as long as the wait signal is low. ____ unless the wait signal is needed, leave it held high. during external bus cycles, at least one wait cycle is inserted even for the shortest-case access. (the shortest bus cycle is 2 bclk periods.) figure 15.2.1 internal bus access during bus free state note : thi-z denotes a high-impedance state. bus-free state internal bus access "h" bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd "h" hi-z "h"
15 15-7 ver.0.10 external bus interface 15.2 read/write operations figure 15.2.2 read/write timing (for shortest-case external access) note : circles above indicate points at which signals are sampled. read (2 cycles) "h" a a a "h" "h" "h" one wait cycle bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd read write (2 cycles) one wait cycle bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd write
15 15-8 ver.0.10 external bus interface 15.2 read/write operations figure 15.2.3 read/write timing (for access with 2 internal and 1 external wait cycles) note : circles above indicate points at which signals are sampled. "h" (don't care) aa "h" a "l" "h" aa (don't care) a a a "l" "h" aa 1 external wait cycle 2 internal wait cycles a a read (4 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd read write (4 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd write 1 external wait cycle 2 internal wait cycles
15 15-9 ver.0.10 external bus interface 15.2 read/write operations figure 15.2.4 internal bus access during bus free state note 1 : hi-z denotes a high-impedance state. note 2 : bclk is not output. (2) when bus mode control register = 1 ___ external read/write operations are performed using the address bus, data bus, and signals cs0, ___ __ ___ ___ ____ __ __ ___ cs1, rd, bhe, ble, wait, and wr. in external read cycle, the rd signal goes low and bhe or ___ ble output for the byte position from which to read is pulled low, reading data from only the byte __ ___ ___ position of the bus. in external write cycle, the wr signal goes low and bhe or ble output for the byte position to which to write is pulled low, writing data to the necessary byte position. ____ when an external bus cycle starts, wait cycles are inserted as long as the wait signal is low. ____ unless the wait signal is needed, leave it held high. during external bus cycle, at least one wait cycle is inserted even for the shortest-case access. (the shortest bus cycle is 2 bclk periods.) when not using the wait function, the pin can be used as p71 by setting the p7 operation mode register p71mod bit to 0. " h" "h" hi-z "h" "h" bus-free state internal bus access bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd wr
15 15-10 ver.0.10 external bus interface 15.2 read/write operations figure 15.2.5 read/write timing (for shortest-case external access) note 1 : circles above indicate points at which signals are sampled. note 2 : bclk is not output. "h" a a a "h" "h" "h" read (2 cycles) one wait cycle bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd read write (2 cycles) one wait cycle bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd write wr wr
15 15-11 ver.0.10 external bus interface 15.2 read/write operations figure 15.2.6 read/write timing (for access with 2 internal and 1 external wait cycles) note 1 : circles above indicate points at which signals are sampled. note 2 : bclk is not output. "h" aa aa "h" a "l" "h" aa a a a "l" "h" aa a a (don't care) 1 external wait cycle 2 internal wait cycles read (4 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd read write (4 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd write 1 external wait cycle 2 internal wait cycles wr wr (don't care)
15 15-12 ver.0.10 figure 15.3.1 bus arbitration timing external bus interface 15.3 bus arbitration 15.3 bus arbitration (1) when bus mode control register = 0 ____ when hreq pin input is pulled low and the hold request is accepted, the 32170 goes to a hold state ____ and outputs a low from the hack pin. during hold state, all bus related pins are placed in the high- impedance state, allowing data to be transferred on the system bus. to exit the hold state and ____ return to normal operating state, release the hreq signal back high. note 1 : circles above indicate points at which signals are sampled. note 2 : hi-z indicate the high-impedance state. note 3 : idle cycles are inserted only when the hold state is assumed after external lead access. db0 - db15 bclk aa hreq hack a11 - a30 cs0 , cs1 rd bhw , blw wait hi-z hi-z hi-z hi-z bus cycle idle go to hold hold state return next bus cycle
15 15-13 ver.0.10 figure 15.3.2 bus arbitration timing external bus interface 15.3 bus arbitration note 1 : circles above indicate points at which signals are sampled. note 2 : hi-z indicate the high-impedance state. note 3 : idle cycles are inserted only when the hold state is assumed after external lead access. (2) when bus mode control register = 1 ____ when hreq pin input is pulled low and the hold request is accepted, the 32170 goes to a hold state ____ and outputs a low from the hack pin. during hold state, all bus related pins are placed in the high- impedance state, allowing data to be transferred on the system bus. to exit the hold state and ____ return to normal operating state, release the hreq signal back high. db0 - db15 bclk hi-z aa aa hreq hack a11 - a30 cs0 , cs1 rd wr bhw , blw wait hi-z hi-z hi-z hi-z bus cycle idle go to hold hold state return next bus cycle
15 15-14 ver.0.10 figure 15.4.1 typical connection of external extension memory (when busmod = 0) note : the 32170 addresses and data are arranged in such a way that bit 0 = msb, and bit 15 = lsb. therefore, the msb and lsb sides must be reversed when connecting external extension memory. external bus interface 15.4 typical connection of external extension memory 15.4 typical connection of external extension memory (1) when bus mode control register = 0 a typical connection when using external extension memory is shown in figure 15.4.1. (external extension memory can only be used in external extension mode and processor mode.) memory mapping internal flash memory (768kb) external memory area (1mb) a a a a a a number of bus wait cycles can be set to 1-4. normall y used as port. wait is used onl y when four or more wait c y cles are needed. h'0000 0000 h'0040 0000 h'0020 0000 h'000c 0000 unused h'0010 0000 1m-cs0 area sram flash memory a18 a0 a a d15 d0 a a rd cs max1mb a18 a0 a a d15 d0 a a rd (d0-d15) cs wr (d0-d7) wr (d8-d15) max1mb 2 (total2mb) 32170f6 a11 a30 a a d0 d15 a a rd cs0 cs1 blw bhw wait external memory area (2mb) 2m-cs1 area *
15 15-15 ver.0.10 figure 15.4.2 typical connection of external extension memory (when busmod = 1) note : the 32170 addresses and data are arranged in such a way that bit 0 = msb, and bit 15 = lsb. therefore, the msb and lsb sides must be reversed when connecting external extension memory. external bus interface 15.4 typical connection of external extension memory (2) when bus mode control register = 1 a typical connection when using external extension memory is shown in figure 15.4.2. (external extension memory can only be used in external extension mode and processor mode.) m32170f6 a11 a30 a a a a d0 d15 a a a a rd cs0 a cs1 ble bhe a wait h'0000 0000 h'0040 0000 h'0020 0000 h'000c 0000 h'0010 0000 a18 a0 a a d15 d0 a a rd cs max1mb a19 a0 a a d15 d0 a a rd (d0-d15) cs bhe (d0-d7) ble (d8-d15) max2mb wr wr (d0-d15) memory mapping internal flash memory (768kb) external memory area (1mb) number of bus wait cycles can be set to 1-4. normall y used as port. wait is used onl y when four or more wait c y cles are needed. unused 1m-cs0 area sram flash memory external memory area (2mb) 2m-cs1 area
15 15-16 ver.0.10 figure 15.4.3 typical connection of external extension memory (using 8/16-bit mixed memories when busmod = 1) note : the 32170 addresses and data are arranged in such a way that bit 0 = msb, and bit 15 = lsb. therefore, the msb and lsb sides must be reversed when connecting external extension memory. external bus interface 15.4 typical connection of external extension memory (3) using 8/16-bit data bus memories in combination when bus mode control register = 1 the diagram below shows a typical connection of external extension memory, with 8-bit data bus memory located in the cs0 area, and 16-bit data bus memory located in the cs1 area. (external extension memory can only be used in external extension mode and processor mode.) note : the qs32x2245 is a product made by idt company. a a a a a when cl = 50 pf, memory can be connected with only 2 ns data delay h'0000 0000 h'0040 0000 h'0020 0000 h'000c 0000 h'0010 0000 8-bit memory a18 a0 a d7 d0 a a rd cs max1mb a19 a0 aa aa d15 d0 aa aa bhe cs wr (d0-d15) rd (d0-d15) max2mb m32170f6vfp a11 a30 a a d0 d15 a rd cs0 cs1 bhe wr wait qs32x2245 a a d7 d8 a a a a a ble ble a0 8-bit bus area memory mapping internal flash memory (768kb) external memory area (1mb) number of bus wait cycles can be set to 1-4. normall y used as port. wait is used onl y when four or more wait c y cles are needed. unused 1m-cs0 area sram external memory area (2mb) 2m-cs1 area 16-bit bus area a b oe a b
chapter 16 chapter 16 wait controller 16.1 outline of the wait controller 16.2 wait controller related registers 16.3 typical operation of the wait controller
16 16-2 ver.0.10 wait controller 16.1 outline of the wait controller 16.1 outline of the wait controller the wait controller controls the number of wait cycles inserted in bus cycles during access to an extended external area. the following outlines the wait controller. table 16.1.1 outline of the wait controller item specification target space wait cycles in following memory spaces are controlled depending on operation mode single-chip mode : no target space (wait controller settings have no effect) external extension mode : cs0 area (1 mbytes), cs1 area (2 mbytes) processor mode : cs0 area (2 mbytes), cs1 area (2 mbytes) number of wait cycles 1 to 4 wait cycles inserted by software + any number of wait cycles inserted from that can be inserted ____ wait pin (bus cycles with 1 wait cycle are the shortest bus cycle for external access.) ___ ___ in external extension mode and processor mode, two chip select signals (cs0, cs1) are output to ___ ___ an extended external area. two areas in it corresponding to cs0 and cs1 signals are called the cs0 and the cs1 areas, respectively. figure 16.1.1 cs0 and cs1 area address map h'0000 0000 h'001f ffff h'0020 0000 h'003f ffff non-cs0 area (internal rom access area) cs1 area (2 mbytes) cs0 area (1 mbytes) h'000f ffff h'0010 0000 extended external area internal rom area reserved area extended external area cs1 area (2 mbytes) cs0 area (2 mbytes)
16 16-3 ver.0.10 wait controller 16.1 outline of the wait controller when accessing an extended external area, the wait controller controls the number of wait cycles to be inserted in bus cycles based on the number of wait cycles set by software and those entered ____ from the wait pin. the number of wait cycles that can controlled in software is 1 to 4. (for external access, bus cycles with 1 wait cycle are the shortest bus cycle.) ____ when the wait pin input is sampled low in the last cycle of internal wait cycles set by software, the ____ ____ wait cycle is extended as long as the wait signal is held low. then when the wait signal is released back high, the wait cycle is terminated and the next new bus cycle is entered into. table 16.1.2 number of wait cycles that can be set by the wait controller extended external area address number of wait cycles inserted cs0 area h'0010 0000 - h'001f ffff one to 4 wait cycles set by software + any number of (external extension mode) ____ wait cycles entered from wait pin h'0000 0000 - h'001f ffff (however, wait cycles set by software have priority.) (processor mode) cs1 area h'0020 0000 - h'003f ffff one to 4 wait cycles set by software + any number of (external extension mode ____ wait cycles entered from wait pin and processor mode) (however, wait cycles set by software have priority.)
16 16-4 ver.0.10 figure 16.2.1 wait controller related register map wait controller 16.2 wait controller related registers 16.2 wait controller related registers the following shows a wait controller related register map. h'0080 0180 address d0 d7 +0 address +1 address d8 d15 wait cycles control register (wtccr) blank addresses are a reserved area.
16 16-5 ver.0.10 16.2.1 wait cycles control register n wait cycles control register (wtccr) d0123456d7 cs0wtc cs1wtc d bit name function r w 0 , 1 no functions assigned 0 2 , 3 cs0wtc 00 : 4 wait cycles (when reset) (cs0 wait cycles control) 01 : 3 wait cycles 10 : 2 wait cycles 11 : 1 wait cycle 4 , 5 no functions assigned 0 6 , 7 cs1wtc 00 : 4 wait cycles (when reset) (cs1 wait cycles control) 01 : 3 wait cycles 10 : 2 wait cycles 11 : 1 wait cycle wait controller 16.2 wait controller related registers
16 16-6 ver.0.10 16.3 typical operation of the wait controller the following shows a typical operation of the wait controller. the wait controller can control bus access in the range of 2 to 5 cycles. if more access cycles than that are needed, use the wait function in combination with the wait controller. (1) when bus mode control register = 0 ___ external read/write operations are performed using the address bus, data bus, and signals cs0, ___ __ ___ ___ ____ cs1, rd, bhw, blw, wait, and bclk. figure 16.3.1 internal bus access during bus free state note : thi-z denotes a high-impedance state. bus-free state internal bus access "h" bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd "h" hi-z "h" wait controller 16.3 typical operation of the wait controller
16 16-7 ver.0.10 figure 16.3.2 read/write timing (for access with 1 internal wait cycle) note : circles above indicate points at which signals are sampled. read (2 cycles) "h" a a a "h" "h" "h" one wait cycle bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd read write (2 cycles) one wait cycle bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd write wait controller 16.3 typical operation of the wait controller
16 16-8 ver.0.10 figure 16.3.3 read/write timing (for access with 2 internal wait cycles) note : circles above indicate points at which signals are sampled. "h" (don't care) aa "h" "h" a (don't care) "h" a 2 internal wait cycles read (3 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd read write (3 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd write 2 internal wait cycles a a a a wait controller 16.3 typical operation of the wait controller
16 16-9 ver.0.10 wait controller 16.3 typical operation of the wait controller figure 16.3.4 read/write timing (for access with 3 internal wait cycles) note : circles above indicate points at which signals are sampled. "h" (don't care) aa "h" "h" aa (don't care) "h" aa 3 internal wait cycles read (4 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd read write (4 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd write 3 internal wait cycles a a a a a a a a
16 16-10 ver.0.10 wait controller 16.3 typical operation of the wait controller figure 16.3.5 read/write timing (for access with 4 internal wait cycles) note : circles above indicate points at which signals are sampled. "h" (don't care) a "h" "h" aa (don't care) "h" aa 4 internal wait cycles read (5 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd read write (5 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd write 4 internal wait cycles a a a a a a a a aa aa aa aa
16 16-11 ver.0.10 wait controller 16.3 typical operation of the wait controller figure 16.3.6 read/write timing (for access with 4 internal and 1 external wait cycles) note : circles above indicate points at which signals are sampled. "h" (don't care) aa "h" "h" (don't care) "h" 4 internal wait cycles read (6 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd read write (6 cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd write 4 internal wait cycles aa aa aa aa a a a a a a a a a a "l" "l" a a 1 external wait cycle 1 external wait cycle
16 16-12 ver.0.10 wait controller 16.3 typical operation of the wait controller figure 16.3.7 read/write timing (for access with 2 internal and n external wait cycles) note : circles above indicate points at which signals are sampled. "h" (don't care) aa "h" "h" (don't care) "h" 2 internal wait cycles read (3+n cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd read write (3+n cycles) bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd write 2 internal wait cycles aa aa aa aa a a "l" "l" a n external wait cycles n external wait cycles "l" a "l" a "l" a "l" a ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ a ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
16 16-13 ver.0.10 wait controller 16.3 typical operation of the wait controller figure 16.3.8 internal bus access during bus free state note 1 : hi-z denotes a high-impedance state. note 2 : bclk is not output. (2) when bus mode control register = 1 ___ external read/write operations are performed using the address bus, data bus, and signals cs0, ___ __ ___ ___ ____ __ cs1, rd, bhe, ble, wait, and wr. "h" "h" hi-z "h" "h" bus-free state internal bus access bclk a11 - a30 cs0, cs1 bhw, blw db0 - db15 wait rd wr
16 16-14 ver.0.10 figure 16.3.9 read/write timing (for access with 1 internal wait cycle) note 1 : circles above indicate points at which signals are sampled. note 2 : bclk is not output. "h" a a a "h" "h" "h" read (2 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd read write (2 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd write wr wr 1 internal wait cycle 1 internal wait cycle wait controller 16.3 typical operation of the wait controller
16 16-15 ver.0.10 figure 16.3.10 read/write timing (for access with 2 internal wait cycles) note 1 : circles above indicate points at which signals are sampled. note 2 : bclk is not output. "h" aa aa "h" "h" a a a "h" a a a (don't care) 2 internal wait cycles read (3 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd read write (3 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd write 2 internal wait cycles wr wr (don't care) wait controller 16.3 typical operation of the wait controller
16 16-16 ver.0.10 figure 16.3.11 read/write timing (for access with 3 internal wait cycles) note 1 : circles above indicate points at which signals are sampled. note 2 : bclk is not output. wait controller 16.3 typical operation of the wait controller "h" aa aa "h" "h" aa a a "h" aa a a (don't care) 3 internal wait cycles read (4 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd read write (4 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd write 3 internal wait cycles wr wr (don't care) a a a a
16 16-17 ver.0.10 figure 16.3.12 read/write timing (for access with 4 internal wait cycles) note 1 : circles above indicate points at which signals are sampled. note 2 : bclk is not output. wait controller 16.3 typical operation of the wait controller "h" a a "h" "h" aa a a "h" aa a a (don't care) 4 internal wait cycles read (5 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd read write (5 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd write 4 internal wait cycles wr wr (don't care) a a a a aa aa aa aa
16 16-18 ver.0.10 figure 16.3.13 read/write timing (for access with 4 internal and 1 external wait cycles) note 1 : circles above indicate points at which signals are sampled. note 2 : bclk is not output. wait controller 16.3 typical operation of the wait controller "h" aa aa "h" "h" a aa aa "h" a aa aa (don't care) 4 internal wait cycles read (6 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd read write (6 cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd write 4 internal wait cycles wr wr (don't care) a a a a a a a a "l" a "l" a 1 external wait cycle 1 external wait cycle
16 16-19 ver.0.10 figure 16.3.14 read/write timing (for access with 2 internal and n external wait cycles) note 1 : circles above indicate points at which signals are sampled. note 2 : bclk is not output. wait controller 16.3 typical operation of the wait controller "h" aa aa "h" "h" a aa aa "h" a aa aa (don't care) 2 internal wait cycles read (3+n cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd read write (3+n cycles) bclk a11 - a30 cs0, cs1 bhe, ble db0 - db15 wait rd write 2 internal wait cycles wr wr (don't care) "l" a "l" a n external wait cycles n external wait cycles "l" a "l" a "l" a "l" a ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
16 16-20 ver.0.10 wait controller 16.3 typical operation of the wait controller * this is a blank page.*
chapter 17 chapter 17 ram backup mode 17.1 outline 17.2 example of ram backup when power is down 17.3 example of ram backup for saving power consumption 17.4 exiting ram backup mode (wakeup)
17 17-2 ver.0.10 17.1 outline in ram backup mode, the contents of the internal ram are retained while the power is turned off. ram backup mode is used for the following two purposes: ? back up the internal ram data when the power is down ? turn off the power to the cpu whenever necessary to save on the system's power consumption the 32r/e cpu is placed in ram backup mode by applying a voltage of 2.0-3.3 v to the vdd pin (provided for ram backup) and 0 v to all other pins. during ram backup mode, the contents of the internal ram are retained, while the cpu and internal peripheral i/o remain idle. also, because all pins except vdd are held low during ram backup mode, power consumption in the system can effectively reduced. 17.2 example of ram backup when power is down a typical circuit for ram backup at power outage is shown in figure 17.2.1. the following explains how the ram can be backed up by using this circuit as an example. ram backup mode 17.1 outline figure 17.2.1 typical circuit for ram backup at power outage note 1 : power outage is detected by the dc in (regulator input) voltage. note 2 : these pins are used to detect a ram backup signal. note 3 : this pin outputs a high when the power is on and outputs a low when the power is down. vrefn sbi adnini m32r/e c backup battery vcc vdd vbb vref reference voltage for power outage detection power outage detection signal backup power supply for power outage power supply monitor ic vdd dc in input output regulator (5v system) vcci avccn osc-vcc out vcce (note 1) output regulator (3.3v system) (note 3) (note 2)
17 17-3 ver.0.10 ram backup mode 17.2 example of ram backup when power is down 17.2.1 normal operating state figure 17.2.2 shows the normal operating state of the m32r/e. during normal operation, input on _______ the sbi pin or adnini (i = 0-15) pin used for ram backup signal detection remains high. figure 17.2.2 normal operating state note 1 : power outage is detected by the dc in (regulator input) voltage. note 2 : these pins are used to detect a ram backup signal. note 3 : this pin outputs a high when the power is on and outputs a low when the power is down. note 4 : backup power supply = 2.0 to 3.3 v vrefn sbi adnini m32r/e c backup battery vcc vdd vbb vref reference voltage for power outage detection power outage detection signal backup power supply for power outage power supply monitor ic vdd dc in input output regulator (5v system) vcci avccn osc-vcc out vcce (note 1) output regulator (3.3v system) (note 3) (note 2) 5v 3.3v 5v 3.3v 5v 3.3v (note 4) "h"
17 17-4 ver.0.10 figure 17.2.3 ram backup state at power outage note 1: power outage is detected by the dc in (regulator input) voltage. note 2: these pins are used to detect a ram backup signal. note 3: this pin outputs a high when the power is on and outputs a low when the power is down. note 4: ___ determined by the input voltage level on sbi pin or adnini pin. note 5: adjust this capacitance to provid the necessary processing time in . ram backup mode 17.2 example of ram backup when power is down 17.2.2 ram backup state shown in figure 17.2.3 is the power outage ram backup state of the m32r/e. when the power supply goes down, the power supply monitor ic starts feeding current from the backup battery to the m32r/e. also, the power supply monitor ic's power outage detection pin outputs a low, causing ___ the sbi pin or adnini pin input to go low, which generates a ram backup signal ( in figure 17.2.3). whether the power is down or not must be determined with respect to the dc in (regulator input) voltage in order to allow for a software processing time at power outage. to enable ram backup mode, make the following settings. (1) create check data to verify after returning from ram backup to normal mode whether the ram data has been retained normally ( in figure 17.2.3). when the power supply to vcc goes down after settings in (1), the voltage applied to the vdd pin becomes 2.0-3.3 v and voltages applied to all other pins drop to 0 v, and the m32r/e thereby enters ram backup mode ( a in figure 17.2.3). vrefn sbi adnini m32r/e c backup battery vcc vdd vbb vref reference voltage for power outage detection power outage detection signal backup power supply for power outage power supply monitor ic vdd dc in input output regulator (5v system) vcci avccn osc-vcc out vcce (note 1) output regulator (3.3v system) (note 3) (note 2) 3.3v 0v (note 4) "l" (note 5) 2.0v - 3.3v example of ram backup processing power goes down (note 4) create check data for backup ram a ram backup mode 0v 0v 0v 0v
17 17-5 ver.0.10 ram backup mode 17.3 example of ram backup for saving power consumption 17.3 example of ram backup for saving power consumption figure 17.3.1 shows a typical circuit for ram backup to save on power consumption. the following explains how the ram is backed up for the purpose of low-power operation by using this circuit as an example. figure 17.3.1 typical circuit for ram backup to save on power consumption note 1 : this signal outputs a low for ram backup. note 2 : this pin outputs a high when the power is on, and is set for input mode when in ram backup mode. note 3 : these pins are used to detect a ram backup signal. ram backup signal (note 1) external circuit port x ib ram backup power supply dc in input output regulator (3.3v system) output regulator (5v system) output regulator (3.3v system) vrefn sbi adnini m32r/e vdd vcci avccn osc-vcc vcce (note 3) (note 2)
17 17-6 ver.0.10 ram backup mode 17.3 example of ram backup for saving power consumption figure 17.3.2 normal operating state note 1 : this signal outputs a low for ram backup. note 2 : this pin outputs a high when the power is on, and is set for input mode when in ram backup mode. note 3 : these pins are used to detect a ram backup signal. 17.3.1 normal operating state figure 17.3.2 shows the normal operating state of the m32r/e. during normal operation, the ram ___ backup signal output by the external signal is high. also, input on the sbi pin or adnini (i = 0-15) pin used for ram backup signal detection remains high. port x, which is the transistor's base connecting pin, should output a high. this causes the transistor's base voltage, ib, to go high, so that current is fed from the power supply to the vcc pin via the transistor. ram backup signal (note 1) external circuit port x ib ram backup power supply dc in input output regulator (3.3v system) output regulator (5v system) output regulator (3.3v system) vrefn sbi adnini m32r/e vdd vcci avccn osc-vcc vcce (note 3) (note 2) 5v 3.3v 5v 3.3v 5v 3.3v "h" "h" "h"
17 17-7 ver.0.10 ram backup mode 17.3 example of ram backup for saving power consumption figure 17.3.3 ram backup state for low-power operation note 1: this signal outputs a low for ram backup. note 2: this pin outputs a high when the power is on, and is set for input mode when in ram backup mode. note 3: these pins are used to detect a ram backup signal. note 4: ___ determined by the input voltage level on sbi pin or adnini pin. note 5: base voltage ib = 0 causes the current fed to the vcc pin to stop. explained in a to d above. 17.3.2 ram backup state figure 17.3.3 shows the ram backup state of the m32r/e. figure 17.3.4 shows a ram backup ___ sequence. when the external circuit outputs a low, input on the sbi pin or adnini pin goes low. a low on these input pins generates a ram backup signal (a and in figure 17.3.3). to enable ram backup mode, make the following settings. (1) create check data to verify after returning from ram backup to normal mode whether the ram data has been retained normally ( in figure 17.3.3). (2) to materialize low-power operation, set all programmable input/output pins except port x for input mode (or for output mode, with pins outputting a low) ( a in figure 17.3.3). (3) set port x for input mode (b and ? in figure 17.3.3). this causes the transistor's base voltage, ib, to go low, so that no current flows from the power supply to the vcc pin via the transistor (c in figure 17.3.3). consequently, the power to the vcc pin is shut off (d in figure 17.3.3). due to settings in (1) to (3), the voltage applied to the vdd pin becomes 3.3 v 10% and voltages applied to all other pins drop to 0 v, thus placing the m32r/e in ram backup mode ( ? in figure 17.2.3). ram backup signal (note 1) external circuit port x ib power supply for ram dc in input output regulator (3.3v system) output regulator (5v system) output regulator (3.3v system) vrefn sbi adnini m32r/e vdd vcci avccn osc-vcc vcce (note 3) (note 2) 3.3v "l" "l" "l" d c "l" "l" b a 0v 0v 0v 0v 0v example of ram backup processing generate ram backup signal (note 4) create check data for backup ram ? ram backup mode set transistor's base connecting pin (port x) for input mode (note 5) a
17 17-8 ver.0.10 ram backup mode 17.3 example of ram backup for saving power consumption figure 17.3.4 example of ram backup sequence for low-power operation 17.3.3 precautions to be observed at power-on when changing port x from input mode to output mode after power-on, pay attention to the following. if port x is set for output mode while no data is set in the port x data register, the port's initial output level is indeterminate. therefore, be sure to set the output high level in the port x data register before you set port x for output mode. unless this method is followed, port output may go low at the same time port output is set after the clock oscillation has stabilized, causing the device to enter ram backup mode. reset sbi adnini vcci, osc-vcc vdd oscillation stabilization time external input signal goes low ram backup period power on port x port input mode f (xin) port output setting (high level) vcce, vrefn, avccn 3.3v 5.0v 0v 0v port output setting (high level) external input signal goes high oscillation stabilization time
17 17-9 ver.0.10 ram backup mode 17.4 exiting ram backup mode (wakeup) 17.4 exiting ram backup mode (wakeup) processing to exit ram backup mode and return to normal operation is referred to as "wakeup processing." figure 17.4.1 shows an example of wakeup processing. wakeup processing is initiated by reset input. the following shows how to execute wakeup processing. (1) reset the device ( in figure 17.4.1). for details about reset, refer to chapter 7, "reset." (2) set port x for output mode and output a high from the port ( in figure 17.4.1).(note) (3) check the ram contents against the check data created before entering ram backup mode ( a in figure 17.4.1). (4) if the ram contents and check data did not match when checked in (3), initialize the ram ( ? in figure 17.4.1). if the ram contents and check data matched, use the retained data in the program. (5) after initializing each internal circuit ( ? in figure 17.4.1), return the main routine ( ? in figure 17.4.1). note : for wakeup from power outage ram backup mode, settings for port x are unnecessary. figure 17.4.1 wakeup processing note : for wakeup from power outage ram backup mode, settings for port x are unnecessary. ok error check ram contents against backup ram check data initialize ram example of wakeup processing reset set transistor's base connecting pin (port x) for high-level output mode (note) initial each internal circuit to main routine ? a ? ?
17 17-10 ver.0.10 ram backup mode 17.4 exiting ram backup mode (wakeup) * this is a blank page.*
chapter 18 chapter 18 oscillation circuit 18.1 oscillator circuit 18.2 clock generator circuit
18 18-2 ver.0.10 oscillation circuit 18.1 oscillator circuit figure 18.1.1 example of a system clock generating circuit 18.1 oscillator circuit the m32r/e contains an oscillator circuit that supplies operating clocks for the cpu core, internal peripheral i/o, and internal memory. the frequency fed to the clock input pin (xin) is multiplied by 4 by the internal pll circuit to produce the cpu clock, which is the operating clock for the cpu core and internal memory. the frequency of this clock is divided by 2 in the subsequent circuit to produce the internal peripheral clock, which is the operating clock for the internal peripheral i/o. 18.1.1 example of an oscillator circuit a clock generating circuit can be configured by connecting a ceramic (or crystal) resonator between the xin and xout pins external to the chip. figure 18.1.1 below shows an example of a system clock generating circuit using a resonator connected external to the chip and an rc network connected to the pll circuit control pin (vcnt). for constants rf, cin, cout, and rd, consult your resonator manufacturer to determine the appropriate values. when you use an externally sourced clock signal without using the internal oscillator circuit, connect the external clock signal to the xin pin and leave the xout pin open. m32r/e oscvcc xin xout oscvss rf rd c in c out vcnt bclk / p70 c oscillator circuit to internal peripheral clock pll circuit 220pf 0.1f 1k w oscillator module oscvcc : 3.3 v power supply to cpu clock 1/2
18 18-3 ver.0.10 oscillation circuit 18.1 oscillator circuit 18.1.2 system clock output function a clock whose frequency is twice the input frequency can be output from the bclk pin. the bclk pin is shared with port p70. when you use this pin to output the system clock, set the p7 operation mode register (p7mod)'s d8 bit to 1. configuration of the p7 operation mode register is shown below. n p7 operation mode register (p7mod) d8 9 1011121314d15 p70mod p71mod p72mod p73mod p74mod p75mod p76mod p77mod d bit name function r w 8 p70mod 0 : p70 (port p70 operation mode) 1 : bclk 9 p71mod 0 : p71 (port p71 operation mode) ____ 1 : wait 10 p72mod 0 : p72 (port p72 operation mode) ____ 1 : hreq 11 p73mod 0 : p73 (port p73 operation mode) ____ 1 : hack 12 p74mod 0 : p74 (port p74 operation mode) 1 : rtdtxd 13 p75mod 0 : p75 (port p75 operation mode) 1 : rtdrxd 14 p76mod 0 : p76 (port p76 operation mode) 1 : rtdack 15 p77mod 0 : p77 (port p77 operation mode) 1 : rtdclk
18 18-4 ver.0.10 oscillation circuit 18.1 oscillator circuit figure 18.1.2 oscillation stabilization time at power-on 18.1.3 oscillation stabilization time at power-on the oscillator circuit comprised of a ceramic (or crystal) resonator has a finite time after power-on at which its oscillation is instable. therefore, create a certain amount of oscillation stabilization time that suits the oscillator circuit used. figure 18.1.2 shows an oscillation stabilization time at power- on. reset xin oscillation stabilization time osc-vcc
18 18-5 ver.0.10 figure 18.2.1 configuration of the clock generator circuit oscillation circuit 18.2 clock generator circuit 18.2 clock generator circuit the clock generator supplies independent clocks to the cpu and internal peripheral circuits. xin (8mhz - 10mhz) bclk (16mhz - 20mhz) cpu clock (32mhz - 40mhz) x4 1/2 1/2 internal peripheral clock (8mhz - 10mhz) 1/4
18 18-6 ver.0.10 oscillation circuit 18.2 clock generator circuit * this is a blank page.*
chapter 19 chapter 19 jtag 19.1 outline of jtag 19.2 configuration of the jtag circuit 19.3 jtag registers 19.4 basic operation of jtag 19.5 boundary scan description language 19.6 precautions about board design when connecting jtag
19 19-2 ver.0.10 19.1 outline of jtag the 32170 contains a jtag (joint test action group) interface based on ieee standard test access port and boundary-scan architecture (ieee std. 1149.1a-1993). this jtag interface can be used as an input/output path for boundary-scan test (boundary-scan path). for details about ieee 1149.1 jtag test access ports, refer to the ieee std. 1149.1a-1993 documentation. the functions of jtag interface related pins mounted on the 32170 are shown below. table 19.1.1 jtag pin functions type symbol pin name i/o function tap jtck test clock input clock input to the test circuit. jtdi test data input input synchronous serial data input pin used to enter test instruction code and test data. this input is sampled on rising edges of jtck. jtdo test data output output synchronous serial data output pin used to output test instruction code and test data. this signal changes state on falling edges of jtck, and is output only in shift-ir or shift- dr state. jtms test mode select input test mode select input to control the test circuit's state transitions. this input is sampled on rising edges of jtck. jtrst test reset input active-low test reset input to initialize the test circuit asynchronously. to ensure that the test circuit is reset without fail, jtms signal input must be held high while this signal changes state from low to high. note : tap = test access port, a jtag interface stipulated in ieee 1149.1. jtag 19.1 outline of jtag (note)
19 19-3 ver.0.10 jtag 19.2 configuration of the jtag circuit figure 19.2.1 configuration of the jtag circuit 19.2 configuration of the jtag circuit the 32170's jtag circuit consists of the following blocks: ? instruction register to hold instruction codes which are fetched through the boundary-scan path ? a set of data registers which are accessed through the boundary-scan path ? test access port (abbreviated tap) controller to control the jtag unit's state transitions ? control logic to select input, output, etc. a configuration of the jtag circuit is shown below. jtck jtms jtrst tap controller instruction register (6 bits) (jtagir) decoder jtdo id code register (jtagidr) bypass register (jtagbpr) boundary-scan register (jtagbsr) jtdi data register set 32170 output selection output selection buffer
19 19-4 ver.0.10 jtag 19.3 jtag registers 19.3 jtag registers 19.3.1 instruction register (jtagir) the instruction register (jtagir) is a 6-bit register to hold instruction code. this register is set in ir path sequence. the instructions set in this register determine the data register to be selected in the subsequent dr path sequence. when test is reset (to initialize the test circuit), the initial value of this register is b'000010 (idcode instruction). after a test reset, the idcode register is selected as the data register until an instruction code is set by an external device. in "capture-ir" state, this register always has b'110001 (fixed value) loaded into it. therefore, when in "shift-ir" state, no matter what value was set in this register, b'110001 is always output from the jtdo pin (sequentially beginning with lsb). however, this value normally is not handled as instruction code. shown below is outside the scope of guaranteed operations. note that if this operation is performed, the device may inadvertently handle b'110001 as instruction code, which makes it unable to operate normally. [capture-ir] ? [exit1-ir] ? [update-ir] the 32170's jtag interface supports the following instructions: three instructions stipulated as essential in ieee 1149.1 (extest, sample/preload, bypass) device id register access instruction (idcode) table 19.3.1 jtag instruction list instruction code abbreviation operation b'000000 extest tests circuit/board-level connections outside the chip. b'000001 sample/preload samples operating circuit status and outputs the sampled status from jtdo pin, while at the same time entering the data used for boundary-scan test from the jtdi pin and presets it in boundary scan register. b'000010 idcode selects id code register and outputs device and manufacturer identification data from jtdo pin. b'111111 bypass selects bypass register and inspects or sets data. note 1 : do not set any other instruction code. note 2 : for details about "ir path sequence," "dr path sequence," "test reset," "capture-ir" state, "shift-ir" state, "exit1-ir" state, and "update-ir" state, refer to section 19.4.
19 19-5 ver.0.10 jtag 19.3 jtag registers 19.3.2 data registers (1) boundary scan register (jtagbsr) the boundary scan register is a 471-bit register used to perform boundary-scan test. bits in this register are assigned to each pin on the 32170. connected between the jtdi and jtdo pins, this register is selected when issuing extest or sample/preload instruction. in "capture-dr" state, this register captures the status of input pins or internal logic output values. in "shift-dr" state, while outputting the sampled value, it is used to set pin functions (input/output pin and tristate output pin direction) and output values by entering data for boundary-scan test. (2) bypass register (jtagbpr) the bypass register is a 1-bit register used to bypass boundary-scan passes when the 32170 is not the target of boundary-scan test. connected between the jtdi and jtdo pins, this register is selected when issuing bypass instruction. this register when in "capture-dr" state has b'0 (fixed value) loaded into it. (3) id code register (jtagidr) the id code register is a 32-bit register used to identify the device and manufacturer. it holds the following information: ? version information (4 bits) : b'0000 ? part number (16 bits) : b'0011 0010 0010 0000 ? manufacturer id (11 bits) : b'000 0001 1100 this register is connected between the jtdi and jtdo pins, and is selected when issuing idcode instruction. when in "capture-dr" state, this register has the said idcode data loaded into it, which is output from the jtdo pin in "shift_dr" state. this register is a read-only register, so that the data written from the jtdi pin during dr pass sequence is ignored. therefore, make sure jtdi input = low during "shift-dr" state. 034 1920 3031 version part number manufacturer id 1 4 bits 16 bits 11 bits note : for details about "capture-dr" and "shift-dr" states, refer to section 19.4.
19 19-6 ver.0.10 jtag 19.4 basic operation of jtag 19.4 basic operation of jtag 19.4.1 outline of jtag operation the instruction and data registers basically are accessed in the following three operations, which are performed based on state transitions of the tap controller. the tap controller changes state according to jtms input, and generates control signals required for operation in each state. ? capture operation the result of boundary-scan test or the fixed data defined for each register is sampled. as register operation, the input data is loaded into the shift register stage. ? shift operation the register is accessed from outside through the boundary-scan path. the sampled value is output to an external device at the same time data is set from outside. as register operation, bits are shifted right between each shift register stage. ? update operation the data set from outside during shift is driven. as register operation, the value set in the shift register stage is transferred to the parallel output stage. the jtag interface undergoes transitions of internal state depending on jtms input as it performs the following two operations. in either case, the operation basically is performed in order of capture ? shift ? update. ? ir path sequence instruction code is set in the instruction register to select the data register to be operated on in the subsequent dr path sequence. ? dr path sequence the selected data register is operated on to inspect or set data.
19 19-7 ver.0.10 jtag 19.4 basic operation of jtag the state transitions of the tap controller and the basic configuration of the 32170's jtag related registers are shown below. figure 19.4.2 basic configuration of jtag related registers note : shown here is the basic configuration, and the configuration of dr and ir does not all have to be like this. figure 19.4.1 tap controller state transition note : values (0 and 1) in this diagram denote the state of jtms input signal. select-dr-scan test-logic-reset run-test/idle 0 1 0 capture-dr 0 shift-dr 0 exit1-dr 1 pause-dr 0 exit2-dr 1 update-dr 1 0 0 1 0 1 1 0 select-ir-scan capture-ir 0 shift-ir 0 exit1-ir 1 pause-ir 0 exit2-ir 1 update-ir 1 0 0 1 0 1 1 0 1 1 1 data input g 0 1 d t q d t r q "shift-dr" or "shift-ir" "clock-dr" or "clock-ir" "update-dr" or "update-ir" test reset from preceding cell to next cell data output parallel output stage shift register stage input multiplexer
19 19-8 ver.0.10 jtag 19.4 basic operation of jtag 19.4.2 ir path sequence instruction code is set in the instruction register (jtagir) to select the data register to be accessed in the subsequent dr path sequence. the ir path sequence is performed following the procedure described below. (1) enter jtms = high for a period of two jtck cycles from "run-test/idle" state to go to "select-ir-scan" state. (2) set jtms = low to go to "capture-ir" state. at this time, b'110001 (fixed value) is set in the instruction register's shift register stage. (3) subsequently, enter jtms = low to go to "shift-ir" state. in "shift-ir" state, the value of the shift register stage is shifted right one bit every cycle, and the data b'110001 (fixed value) that was set in (2) is serially output from the jtdo pin. at the same time, the instruction code serially entered from the jtdi pin is set in the shift register stage bit by bit. because instruction code is set in the instruction register which is comprised of 6 bits, the "shift-ir" state continues for a period of 6 jtck cycles. to stop the shift operation in the middle, go to "pause-ir" state via temporarily "exit1-ir" state (by setting jtms input from high to low). also, to return from "pause-ir" state, go to "shift-ir" state via temporarily "exit1-ir" state (by setting jtms input from high to low). (4) by setting jtms = high, go from "shift-ir" state to "exit1-ir" state. this completes the shift operation. (5) subsequently, enter jtms = high to go to "update-ir" state. in "update-ir" state, the instruction code that was set in the instruction register's shift register stage is transferred to the instruction register's parallel output stage and, thus, jtag instruction decoding begins. (6) subsequently, enter jtms = high to go to "select-dr-scan" state or jtms = low to go to "run-test/idle" state.
19 19-9 ver.0.10 jtag 19.4 basic operation of jtag figure 19.4.3 ir path sequence jtck select-dr-scan select-ir-scan capture-ir shift-ir exit1-ir update-ir run-test/idle run-test/idle don't care don't care instruction code (6 bits) 1 0 0 0 1 1 lsb value jtms tap state jtdi jtdo high impedance shift output from the instruction register is fixed to b'110001. finished storing instruction code in the instruction register's shift register stage. instruction code is set in the parallel output stage at fall of jtck in "update-ir" state. jtdi input is sampled at rise of jtck in "shift-ir" state. jtdo is output at fall of jtck in "shift-ir" state. msb value high impedance
19 19-10 ver.0.10 jtag 19.4 basic operation of jtag 19.4.3 dr path sequence the data register that was selected during the ir path sequence prior to the dr path sequence is operated on to inspect or set data in it. the dr path sequence is performed following the procedure described below. (1) enter jtms = high for a period of one jtck cycle from "run-test/idle" state to go to "select- dr-scan" state. which data register will be selected at this time depends on the instruction that was set during the ir path sequence performed prior to the dr path sequence. (2) set jtms = low to go to "capture-dr" state. at this time, the result of boundary-scan test or the fixed data defined for each register is set in the data register's shift register stage. (3) subsequently, enter jtms = low to go to "shift-dr" state. in "shift-dr" state, the dr value is shifted right one bit every cycle, and the data that was set in (2) is serially output from the jtdo in. at the same time, the setup data serially entered from the jtdi pin is set in the data register's shift register stage bit by bit. by continuing the "shift-dr" state as long as the number of bits of the selected data register (by entering jtms = low), all bits of data can be set in and read out from the shift register stage. to stop the shift operation in the middle, go to "pause-dr" state via temporarily "exit1-dr" state (by setting jtms input from high to low). also, to return from "pause-dr" state, go to "shift-dr" state via temporarily "exit1-dr" state (by setting jtms input from high to low). (4) set jtms = high to go from "shift-dr" state to "exit2-dr" state. this completes the shift operation. (5) subsequently, enter jtms = high to go to "update-dr" state. in "update-dr" state, the data that was set in the data register's shift register stage is transferred to the parallel output stage and, thus, the setup data becomes ready for use. (6) subsequently, enter jtms = high to go to "select-dr-scan" state or jtms = low to go to "run-test/idle" state.
19 19-11 ver.0.10 jtag 19.4 basic operation of jtag figure 19.4.4 dr path sequence note: the shift operation of the data register for the shift register stage is right-shifted, therefore, the output from jtdo is from the lsb side. input to jtdi starts from the value to be set in lsb side. jtck select-dr-scan capture-dr shift-dr exit1-dr update-dr run-test/idle run-test/idle don't care don't care jtms jtdi jtdo finished storing setup data in the shift register stage of the selected data register. setup data is set in the parallel output stage at fall of jtck in "update-dr" state. jtdi input is sampled at rise of jtck in "shift-dr" state. a a a a a a a a a a a a a tap state lsb value high impedance msb value high impedance jtdo is output at fall of jtck in "shift-dr" state.
19 19-12 ver.0.10 jtag 19.4 basic operation of jtag 19.4.4 examining and setting data registers to inspect or set the data register, follow the procedure described below. (1) to access the test access port (jtag) for the first time, enter test reset (to initialize the test circuit). test reset can be entered by one of the following two methods: ? pull jtrst pin input low ? drive jtms pin input high and enter jtck for 5 cycles or more (2) set jtms = low to go to "run-test/idle" state. to continue the idle state, hold jtms input low. (3) set jtms = high to exit "run-test/idle" state and perform ir path sequence. in ir path sequence, specify the data register you want to inspect or set. (4) subsequently, perform dr path sequence. for the data register specified in ir path sequence, enter setup data from the jtdi pin and read out reference data from the jtdo pin. (5) if after dr path sequence is completed you want to proceed and perform ir path sequence or dr path sequence, enter jtms = high to return to "select-dr-scan" state. if after a series of ir and dr path sequence processing is completed you want to wait for the next processing, enter jtms = low to go to "run-test/idle" state and retain the state.
19 19-13 ver.0.10 jtag 19.4 basic operation of jtag figure 19.4.5 continuous jtag access note 1 : the setup value for each register must be entered from the jtdi pin beginning with the lsb. note 2 : the value of each register is output from the jtdo pin beginning with the lsb. the jtdo pin outputs valid data in only "shift-ir" state of ir path sequence and "shift-dr" state of dr path sequence. in all other states, the jtdo pin is tristated (high impedance). note 3 : data can only be read out from the data register which is selected by the instruction that was set in the immediately preceding ir path sequence. output in the selected data register's shift register stage is the value that was sampled during "capture-dr" state. specify the data register you want to inspect or set. test-logic- reset state run-test /idle state ir path sequence tap states instruction code #0 setup data #0 jtdi (note 1) fixed value b'110001 (note 3) jtdo (note 2) setup data is entered serially from jtdi. reference data is serially output from jtdo. (1) basic access same data register can be operated on to inspect or set data continuously. (2) continuous access to the same data re g ister specify the data register you want to inspect or set. dr path sequence run-test /idle state ir path sequence dr path sequence instruction code #1 setup data #1 fixed value b'110001 (note 3) test-logic- reset state run-test /idle state ir path sequence tap states instruction code #0 setup data #0 jtdi (note 1) fixed value b'110001 (note 3) jtdo (note 2) dr path sequence run-test /idle state ir path sequence dr path sequence setup data #2 (note 3) setup data #1 (note 3)
19 19-14 ver.0.10 jtag 19.5 boundary scan description language 19.5 boundary scan description language the boundary scan description language (abbreviated bsdl) is stipulated in supplements to "standard test access port and boundary-scan architecture" of ieee 1149.1-1990 and ieee 1149.1a-1993. bsdl is a subset of ieee 1076-1993 standard vhsic hardware description language (vhdl). bsdl helps to precisely describe the functions of standard-compliant components to be tested. for package connection test, this language is used by automated test pattern generation tools, and for synthesized test logic and verification, it is used by electronic design automation tools. bsdl provides powerful extended functions usable in internal test generation and necessary to write hardware debug and diagnostics software. the primary section of bsdl contains statements of logical port description, physical pin map, instruction set, and boundary register description. ? logical port description the logical port description assigns meaningful symbol names to each pin on the chip. this determines the logic type of input, output, input/output, buffer, or link of each pin that defines the logical direction of signal flow. ? physical pin map the physical pin map correlates the chip's logical ports to the physical pins on each package. use of separate names for each map makes it possible to define multiple physical pin maps in one bsdl description. ? instruction set statement the instruction set statement writes bit patterns to be shifted in into the chip's instruction register. this bit pattern is necessary to place the chip into each test mode defined in standards. it is also possible to write instructions exclusive to the chip. ? boundary register description the boundary register description is a list of boundary register cells or shift stages. each cell is assigned a separate number. the cell with number 0 is located closest to the test data output (jtdo) pin, and the cell with the largest number is located closest to the test data input (jtdi) pin. cells also contain related other information which includes cell type, logical port corresponding to cell, logical function of cell, safety value, control cell number, disable value, and result value. the bsdl for the 32170 shown in the pages to follow have been prepared for use in test engineering for the purpose of pcb design and those stipulated in ieee 1149.1 standards.
19 19-15 ver.0.10 figure 19.5.1 bsdl description for the 32170 (1/19) -- boundary scan description language (bsdl) for -- m32170f6vfp: m32r/e m32170 group, flash 768kb, 240p6y_a -- modification history -- date author version -- created '99/06/01 mitsubishi ver. 0.0 -- modified '--/--/-- entity m32170f6vfp is generic (physical_pin_map : string := "p6y240_a"); port ( ad1in12 :linkage bit; ad1in13 :linkage bit; ad1in14 :linkage bit; ad1in15 :linkage bit; avss_5 :linkage bit; p43 :inout bit; p44 :inout bit; p45 :inout bit; p46 :inout bit; p47 :inout bit; p220 :inout bit; p221 :in bit; p222 :inout bit; p223 :inout bit; p224 :inout bit; p225 :inout bit; vss_17 :linkage bit; oscvss_18 :linkage bit; xin :in bit; xout :buffer bit; oscvcc_21 :linkage bit; vss_22 :linkage bit; vcnt_23 :linkage bit; vss_24 :linkage bit; p30 :inout bit; p31 :inout bit; p32 :inout bit; p33 :inout bit; p34 :inout bit; p35 :inout bit; p36 :inout bit; p37 :inout bit; p20 :inout bit; p21 :inout bit; p22 :inout bit; p23 :inout bit; vcce_37 :linkage bit; vss_38 :linkage bit; p24 :inout bit; p25 :inout bit; p26 :inout bit; p27 :inout bit; p00 :inout bit; p01 :inout bit; jtag 19.5 boundary scan description language
19 19-16 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.2 bsdl description for the 32170 (2/19) p02 :inout bit; p03 :inout bit; p04 :inout bit; p05 :inout bit; p06 :inout bit; p07 :inout bit; vcce_51 :linkage bit; vss_52 :linkage bit; p10 :inout bit; p11 :inout bit; p12 :inout bit; p13 :inout bit; p14 :inout bit; p15 :inout bit; p16 :inout bit; p17 :inout bit; vref_61 :linkage bit; avcc_62 :linkage bit; ad0in0 :linkage bit; ad0in1 :linkage bit; ad0in2 :linkage bit; ad0in3 :linkage bit; ad0in4 :linkage bit; ad0in5 :linkage bit; ad0in6 :linkage bit; ad0in7 :linkage bit; ad0in8 :linkage bit; ad0in9 :linkage bit; ad0in10 :linkage bit; ad0in11 :linkage bit; ad0in12 :linkage bit; ad0in13 :linkage bit; ad0in14 :linkage bit; ad0in15 :linkage bit; avss_79 :linkage bit; vcce_80 :linkage bit; vss_81 :linkage bit; p180 :inout bit; p181 :inout bit; p182 :inout bit; p183 :inout bit; p184 :inout bit; p185 :inout bit; p186 :inout bit; p187 :inout bit; p190 :inout bit; p191 :inout bit; p192 :inout bit; p193 :inout bit; p194 :inout bit; p195 :inout bit; p196 :inout bit; p197 :inout bit; vcci_98 :linkage bit; vss_99 :linkage bit; p160 :inout bit;
19 19-17 ver.0.10 figure 19.5.3 bsdl description for the 32170 (3/19) jtag 19.5 boundary scan description language p161 :inout bit; p162 :inout bit; p163 :inout bit; p164 :inout bit; p165 :inout bit; p166 :inout bit; p167 :inout bit; p172 :inout bit; p173 :inout bit; p174 :inout bit; p175 :inout bit; p176 :inout bit; p177 :inout bit; vcce_114 :linkage bit; vss_115 :linkage bit; p82 :inout bit; p83 :inout bit; p84 :inout bit; p85 :inout bit; p86 :inout bit; p87 :inout bit; p200 :inout bit; p201 :inout bit; p202 :inout bit; p203 :inout bit; vcci_126 :linkage bit; vss_127 :linkage bit; fvcc_128 :linkage bit; vss_129 :linkage bit; p61 :inout bit; p62 :inout bit; p63 :inout bit; p64 :in bit; p65 :inout bit; p66 :inout bit; p67 :inout bit; vcci_137 :linkage bit; vss_138 :linkage bit; vcce_139 :linkage bit; p70 :inout bit; p71 :inout bit; p72 :inout bit; p73 :inout bit; p74 :inout bit; p75 :inout bit; p76 :inout bit; p77 :inout bit; p93 :inout bit; p94 :inout bit; p95 :inout bit; p96 :inout bit; p97 :inout bit; reset :in bit; mod0 :in bit; mod1 :in bit; fp :in bit;
19 19-18 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.4 bsdl description for the 32170 (4/19) vcce_157 :linkage bit; vss_158 :linkage bit; p110 :inout bit; p111 :inout bit; p112 :inout bit; p113 :inout bit; p114 :inout bit; p115 :inout bit; p116 :inout bit; p117 :inout bit; p100 :inout bit; p101 :inout bit; p102 :inout bit; vdd_170 :linkage bit; vcci_171 :linkage bit; vss_172 :linkage bit; p210 :inout bit; p211 :inout bit; p212 :inout bit; p213 :inout bit; p214 :inout bit; p215 :inout bit; p216 :inout bit; p217 :inout bit; tms :in bit; tck :in bit; trst :in bit; tdo :out bit; tdi :in bit; p103 :inout bit; p104 :inout bit; p105 :inout bit; p106 :inout bit; p107 :inout bit; p124 :inout bit; p125 :inout bit; p126 :inout bit; p127 :inout bit; vcci_195 :linkage bit; vss_196 :linkage bit; p130 :inout bit; p131 :inout bit; p132 :inout bit; p133 :inout bit; p134 :inout bit; p135 :inout bit; p136 :inout bit; p137 :inout bit; vcce_205 :linkage bit; vss_206 :linkage bit; p140 :inout bit; p141 :inout bit; p142 :inout bit; p143 :inout bit; p144 :inout bit; p145 :inout bit;
19 19-19 ver.0.10 figure 19.5.5 bsdl description for the 32170 (5/19) jtag 19.5 boundary scan description language p146 :inout bit; p147 :inout bit; p150 :inout bit; p151 :inout bit; p152 :inout bit; p153 :inout bit; p154 :inout bit; p155 :inout bit; p156 :inout bit; p157 :inout bit; p41 :inout bit; p42 :inout bit; vcci_225 :linkage bit; vss_226 :linkage bit; vref_227 :linkage bit; avcc_228 :linkage bit; ad1in0 :linkage bit; ad1in1 :linkage bit; ad1in2 :linkage bit; ad1in3 :linkage bit; ad1in4 :linkage bit; ad1in5 :linkage bit; ad1in6 :linkage bit; ad1in7 :linkage bit; ad1in8 :linkage bit; ad1in9 :linkage bit; ad1in10 :linkage bit; ad1in11 :linkage bit ); use std_1149_1_1994.all; attribute component_conformance of m32170f6vfp : entity is "std_1149_1_1993"; attribute pin_map of m32170f6vfp : entity is physical_pin_map; constant p6y240_a : pin_map_string := "ad1in12 :1," & "ad1in13 :2," & "ad1in14 :3," & "ad1in15 :4," & "avss_5 :5," & "p43 :6," & "p44 :7," & "p45 :8," & "p46 :9," & "p47 :10," & "p220 :11," & "p221 :12," & "p222 :13," & "p223 :14," & "p224 :15," & "p225 :16," & "vss_17 :17," & "oscvss_18 :18," & "xin :19," & "xout :20," &
19 19-20 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.6 bsdl description for the 32170 (6/19) "oscvcc_21 :21," & "vss_22 :22," & "vcnt_23 :23," & "vss_24 :24," & "p30 :25," & "p31 :26," & "p32 :27," & "p33 :28," & "p34 :29," & "p35 :30," & "p36 :31," & "p37 :32," & "p20 :33," & "p21 :34," & "p22 :35," & "p23 :36," & "vcce_37 :37," & "vss_38 :38," & "p24 :39," & "p25 :40," & "p26 :41," & "p27 :42," & "p00 :43," & "p01 :44," & "p02 :45," & "p03 :46," & "p04 :47," & "p05 :48," & "p06 :49," & "p07 :50," & "vcce_51 :51," & "vss_52 :52," & "p10 :53," & "p11 :54," & "p12 :55," & "p13 :56," & "p14 :57," & "p15 :58," & "p16 :59," & "p17 :60," & "vref_61 :61," & "avcc_62 :62," & "ad0in0 :63," & "ad0in1 :64," & "ad0in2 :65," & "ad0in3 :66," & "ad0in4 :67," & "ad0in5 :68," & "ad0in6 :69," & "ad0in7 :70," & "ad0in8 :71," & "ad0in9 :72," & "ad0in10 :73," & "ad0in11 :74," & "ad0in12 :75," & "ad0in13 :76," &
19 19-21 ver.0.10 figure 19.5.7 bsdl description for the 32170 (7/19) jtag 19.5 boundary scan description language "ad0in14 :77," & "ad0in15 :78," & "avss_79 :79," & "vcce_80 :80," & "vss_81 :81," & "p180 :82," & "p181 :83," & "p182 :84," & "p183 :85," & "p184 :86," & "p185 :87," & "p186 :88," & "p187 :89," & "p190 :90," & "p191 :91," & "p192 :92," & "p193 :93," & "p194 :94," & "p195 :95," & "p196 :96," & "p197 :97," & "vcci_98 :98," & "vss_99 :99," & "p160 :100," & "p161 :101," & "p162 :102," & "p163 :103," & "p164 :104," & "p165 :105," & "p166 :106," & "p167 :107," & "p172 :108," & "p173 :109," & "p174 :110," & "p175 :111," & "p176 :112," & "p177 :113," & "vcce_114 :114," & "vss_115 :115," & "p82 :116," & "p83 :117," & "p84 :118," & "p85 :119," & "p86 :120," & "p87 :121," & "p200 :122," & "p201 :123," & "p202 :124," & "p203 :125," & "vcci_126 :126," & "vss_127 :127," & "fvcc_128 :128," & "vss_129 :129," & "p61 :130," & "p62 :131," & "p63 :132," &
19 19-22 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.8 bsdl description for the 32170 (8/19) "p64 :133," & "p65 :134," & "p66 :135," & "p67 :136," & "vcci_137 :137," & "vss_138 :138," & "vcce_139 :139," & "p70 :140," & "p71 :141," & "p72 :142," & "p73 :143," & "p74 :144," & "p75 :145," & "p76 :146," & "p77 :147," & "p93 :148," & "p94 :149," & "p95 :150," & "p96 :151," & "p97 :152," & "reset :153," & "mod0 :154," & "mod1 :155," & "fp :156," & "vcce_157 :157," & "vss_158 :158," & "p110 :159," & "p111 :160," & "p112 :161," & "p113 :162," & "p114 :163," & "p115 :164," & "p116 :165," & "p117 :166," & "p100 :167," & "p101 :168," & "p102 :169," & "vdd_170 :170," & "vcci_171 :171," & "vss_172 :172," & "p210 :173," & "p211 :174," & "p212 :175," & "p213 :176," & "p214 :177," & "p215 :178," & "p216 :179," & "p217 :180," & "tms :181," & "tck :182," & "trst :183," & "tdo :184," & "tdi :185," & "p103 :186," & "p104 :187," & "p105 :188," &
19 19-23 ver.0.10 figure 19.5.9 bsdl description for the 32170 (9/19) jtag 19.5 boundary scan description language "p106 :189," & "p107 :190," & "p124 :191," & "p125 :192," & "p126 :193," & "p127 :194," & "vcci_195 :195," & "vss_196 :196," & "p130 :197," & "p131 :198," & "p132 :199," & "p133 :200," & "p134 :201," & "p135 :202," & "p136 :203," & "p137 :204," & "vcce_205 :205," & "vss_206 :206," & "p140 :207," & "p141 :208," & "p142 :209," & "p143 :210," & "p144 :211," & "p145 :212," & "p146 :213," & "p147 :214," & "p150 :215," & "p151 :216," & "p152 :217," & "p153 :218," & "p154 :219," & "p155 :220," & "p156 :221," & "p157 :222," & "p41 :223," & "p42 :224," & "vcci_225 :225," & "vss_226 :226," & "vref_227 :227," & "avcc_228 :228," & "ad1in0 :229," & "ad1in1 :230," & "ad1in2 :231," & "ad1in3 :232," & "ad1in4 :233," & "ad1in5 :234," & "ad1in6 :235," & "ad1in7 :236," & "ad1in8 :237," & "ad1in9 :238," & "ad1in10 :239," & "ad1in11 :240" ; attribute tap_scan_in of tdi : signal is true; attribute tap_scan_mode of tms : signal is true; attribute tap_scan_out of tdo : signal is true;
19 19-24 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.10 bsdl description for the 32170 (10/19) attribute tap_scan_clock of tck : signal is (5.0e6, both); attribute tap_scan_reset of trst : signal is true; attribute instruction_length of m32170f6vfp : entity is 6; attribute instruction_opcode of m32170f6vfp : entity is "bypass (111111)," & "sample (000001)," & "extest (000000)," & "idcode (000010)," & "usercode (000011)," & "mdm_system (001000)," & "mdm_control (001001)," & "mdm_setup (001010)," & "mtm_control (001111)," & "mon_code (010000)," & "mon_data (010001)," & "mon_param (010010)," & "mon_access (010011)," & "dma_raddr (011000)," & "dma_rdata (011001)," & "dma_rtype (011010)," & "dma_access (011011)," & "rtdenb (100000)" ; attribute instruction_capture of m32170f6vfp : entity is "110001"; attribute instruction_private of m32170f6vfp : entity is "mdm_system," & "mdm_control," & "mdm_setup," & "mtm_control," & "mon_code," & "mon_data," & "mon_param," & "mon_access," & "dma_raddr," & "dma_rdata," & "dma_rtype," & "dma_access," & "rtdenb" ; attribute idcode_register of m32170f6vfp : entity is "0000" & -- version "0011001000100000" & -- part number "00000011100" & -- manufacturer's identity "1"; -- required by 1149.1 attribute usercode_register of m32170f6vfp : entity is "0000 0000 0000 0000" & -- reserved "0000" & -- reserved "0001" & -- rom "0000" & -- isa "0001"; -- sdi version attribute register_access of m32170f6vfp : entity is "bypass (bypass)," & "boundary (sample, extest)," & "idcode (idcode)," &
19 19-25 ver.0.10 figure 19.5.11 bsdl description for the 32170 (11/19) jtag 19.5 boundary scan description language "usercode_reg[32] (usercode)," & "mdm_system_reg[17] (mdm_system)," & "mdm_control_reg[20] (mdm_control)," & "mdm_setup_reg[2] (mdm_setup)," & "mtm_control_reg[4] (mtm_control)," & "mon_code_reg[32] (mon_code)," & "mon_data_reg[32] (mon_data)," & "mon_param_reg[32] (mon_param)," & "mon_access_reg[4] (mon_access)," & "dma_raddr_reg[32] (dma_raddr)," & "dma_rdata_reg[32] (dma_rdata)," & "dma_rtype_reg[3] (dma_rtype)," & "dma_access_reg[3] (dma_access)," & "rtdenb_reg[1] (rtdenb)"; attribute boundary_length of m32170f6vfp : entity is 471; attribute boundary_register of m32170f6vfp : entity is -- -- num cell port function safe [ccell disval rslt] -- "470 (bc_4, p103, observe_only, x)," & "469 (bc_1, p103, output3, x, 468, 0, z)," & "468 (bc_1, *, control, 0)," & "467 (bc_4, p104, observe_only, x)," & "466 (bc_1, p104, output3, x, 465, 0, z)," & "465 (bc_1, *, control, 0)," & "464 (bc_4, p105, observe_only, x)," & "463 (bc_1, p105, output3, x, 462, 0, z)," & "462 (bc_1, *, control, 0)," & "461 (bc_4, p106, observe_only, x)," & "460 (bc_1, p106, output3, x, 459, 0, z)," & "459 (bc_1, *, control, 0)," & "458 (bc_4, p107, observe_only, x)," & "457 (bc_1, p107, output3, x, 456, 0, z)," & "456 (bc_1, *, control, 0)," & "455 (bc_4, p124, observe_only, x)," & "454 (bc_1, p124, output3, x, 453, 0, z)," & "453 (bc_1, *, control, 0)," & "452 (bc_4, p125, observe_only, x)," & "451 (bc_1, p125, output3, x, 450, 0, z)," & "450 (bc_1, *, control, 0)," & "449 (bc_4, p126, observe_only, x)," & "448 (bc_1, p126, output3, x, 447, 0, z)," & "447 (bc_1, *, control, 0)," & "446 (bc_4, p127, observe_only, x)," & "445 (bc_1, p127, output3, x, 444, 0, z)," & "444 (bc_1, *, control, 0)," & "443 (bc_4, p130, observe_only, x)," & "442 (bc_1, p130, output3, x, 441, 0, z)," & "441 (bc_1, *, control, 0)," & "440 (bc_4, p131, observe_only, x)," & "439 (bc_1, p131, output3, x, 438, 0, z)," & "438 (bc_1, *, control, 0)," & "437 (bc_4, p132, observe_only, x)," & "436 (bc_1, p132, output3, x, 435, 0, z)," & "435 (bc_1, *, control, 0)," &
19 19-26 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.12 bsdl description for the 32170 (12/19) "434 (bc_4, p133, observe_only, x)," & "433 (bc_1, p133, output3, x, 432, 0, z)," & "432 (bc_1, *, control, 0)," & "431 (bc_4, p134, observe_only, x)," & "430 (bc_1, p134, output3, x, 429, 0, z)," & "429 (bc_1, *, control, 0)," & "428 (bc_4, p135, observe_only, x)," & "427 (bc_1, p135, output3, x, 426, 0, z)," & "426 (bc_1, *, control, 0)," & "425 (bc_4, p136, observe_only, x)," & "424 (bc_1, p136, output3, x, 423, 0, z)," & "423 (bc_1, *, control, 0)," & "422 (bc_4, p137, observe_only, x)," & "421 (bc_1, p137, output3, x, 420, 0, z)," & "420 (bc_1, *, control, 0)," & "419 (bc_4, p140, observe_only, x)," & "418 (bc_1, p140, output3, x, 417, 0, z)," & "417 (bc_1, *, control, 0)," & "416 (bc_4, p141, observe_only, x)," & "415 (bc_1, p141, output3, x, 414, 0, z)," & "414 (bc_1, *, control, 0)," & "413 (bc_4, p142, observe_only, x)," & "412 (bc_1, p142, output3, x, 411, 0, z)," & "411 (bc_1, *, control, 0)," & "410 (bc_4, p143, observe_only, x)," & "409 (bc_1, p143, output3, x, 408, 0, z)," & "408 (bc_1, *, control, 0)," & "407 (bc_4, p144, observe_only, x)," & "406 (bc_1, p144, output3, x, 405, 0, z)," & "405 (bc_1, *, control, 0)," & "404 (bc_4, p145, observe_only, x)," & "403 (bc_1, p145, output3, x, 402, 0, z)," & "402 (bc_1, *, control, 0)," & "401 (bc_4, p146, observe_only, x)," & "400 (bc_1, p146, output3, x, 399, 0, z)," & "399 (bc_1, *, control, 0)," & "398 (bc_4, p147, observe_only, x)," & "397 (bc_1, p147, output3, x, 396, 0, z)," & "396 (bc_1, *, control, 0)," & "395 (bc_4, p150, observe_only, x)," & "394 (bc_1, p150, output3, x, 393, 0, z)," & "393 (bc_1, *, control, 0)," & "392 (bc_4, p151, observe_only, x)," & "391 (bc_1, p151, output3, x, 390, 0, z)," & "390 (bc_1, *, control, 0)," & "389 (bc_4, p152, observe_only, x)," & "388 (bc_1, p152, output3, x, 387, 0, z)," & "387 (bc_1, *, control, 0)," & "386 (bc_4, p153, observe_only, x)," & "385 (bc_1, p153, output3, x, 384, 0, z)," & "384 (bc_1, *, control, 0)," & "383 (bc_4, p154, observe_only, x)," & "382 (bc_1, p154, output3, x, 381, 0, z)," & "381 (bc_1, *, control, 0)," & "380 (bc_4, p155, observe_only, x)," & "379 (bc_1, p155, output3, x, 378, 0, z)," &
19 19-27 ver.0.10 figure 19.5.13 bsdl description for the 32170 (13/19) jtag 19.5 boundary scan description language "378 (bc_1, *, control, 0)," & "377 (bc_4, p156, observe_only, x)," & "376 (bc_1, p156, output3, x, 375, 0, z)," & "375 (bc_1, *, control, 0)," & "374 (bc_4, p157, observe_only, x)," & "373 (bc_1, p157, output3, x, 372, 0, z)," & "372 (bc_1, *, control, 0)," & "371 (bc_4, p41, observe_only, x)," & "370 (bc_1, p41, output3, x, 369, 0, z)," & "369 (bc_1, *, control, 0)," & "368 (bc_4, p42, observe_only, x)," & "367 (bc_1, p42, output3, x, 366, 0, z)," & "366 (bc_1, *, control, 0)," & "365 (bc_4, p43, observe_only, x)," & "364 (bc_1, p43, output3, x, 363, 0, z)," & "363 (bc_1, *, control, 0)," & "362 (bc_4, p44, observe_only, x)," & "361 (bc_1, p44, output3, x, 360, 0, z)," & "360 (bc_1, *, control, 0)," & "359 (bc_4, p45, observe_only, x)," & "358 (bc_1, p45, output3, x, 357, 0, z)," & "357 (bc_1, *, control, 0)," & "356 (bc_4, p46, observe_only, x)," & "355 (bc_1, p46, output3, x, 354, 0, z)," & "354 (bc_1, *, control, 0)," & "353 (bc_4, p47, observe_only, x)," & "352 (bc_1, p47, output3, x, 351, 0, z)," & "351 (bc_1, *, control, 0)," & "350 (bc_4, p220, observe_only, x)," & "349 (bc_1, p220, output3, x, 348, 0, z)," & "348 (bc_1, *, control, 0)," & "347 (bc_4, p221, observe_only, x)," & "346 (bc_4, p222, observe_only, x)," & "345 (bc_1, p222, output3, x, 344, 0, z)," & "344 (bc_1, *, control, 0)," & "343 (bc_4, p223, observe_only, x)," & "342 (bc_1, p223, output3, x, 341, 0, z)," & "341 (bc_1, *, control, 0)," & "340 (bc_4, p224, observe_only, x)," & "339 (bc_1, p224, output3, x, 338, 0, z)," & "338 (bc_1, *, control, 0)," & "337 (bc_4, p225, observe_only, x)," & "336 (bc_1, p225, output3, x, 335, 0, z)," & "335 (bc_1, *, control, 0)," & "334 (bc_4, p30, observe_only, x)," & "333 (bc_1, p30, output3, x, 332, 0, z)," & "332 (bc_1, *, control, 0)," & "331 (bc_4, p31, observe_only, x)," & "330 (bc_1, p31, output3, x, 329, 0, z)," & "329 (bc_1, *, control, 0)," & "328 (bc_4, p32, observe_only, x)," & "327 (bc_1, p32, output3, x, 326, 0, z)," & "326 (bc_1, *, control, 0)," & "325 (bc_4, p33, observe_only, x)," & "324 (bc_1, p33, output3, x, 323, 0, z)," &
19 19-28 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.14 bsdl description for the 32170 (14/19) "322 (bc_4, p34, observe_only, x)," & "321 (bc_1, p34, output3, x, 320, 0, z)," & "320 (bc_1, *, control, 0)," & "319 (bc_4, p35, observe_only, x)," & "318 (bc_1, p35, output3, x, 317, 0, z)," & "317 (bc_1, *, control, 0)," & "316 (bc_4, p36, observe_only, x)," & "315 (bc_1, p36, output3, x, 314, 0, z)," & "314 (bc_1, *, control, 0)," & "313 (bc_4, p37, observe_only, x)," & "312 (bc_1, p37, output3, x, 311, 0, z)," & "311 (bc_1, *, control, 0)," & "310 (bc_4, p20, observe_only, x)," & "309 (bc_1, p20, output3, x, 308, 0, z)," & "308 (bc_1, *, control, 0)," & "307 (bc_4, p21, observe_only, x)," & "306 (bc_1, p21, output3, x, 305, 0, z)," & "305 (bc_1, *, control, 0)," & "304 (bc_4, p22, observe_only, x)," & "303 (bc_1, p22, output3, x, 302, 0, z)," & "302 (bc_1, *, control, 0)," & "301 (bc_4, p23, observe_only, x)," & "300 (bc_1, p23, output3, x, 299, 0, z)," & "299 (bc_1, *, control, 0)," & "298 (bc_4, p24, observe_only, x)," & "297 (bc_1, p24, output3, x, 296, 0, z)," & "296 (bc_1, *, control, 0)," & "295 (bc_4, p25, observe_only, x)," & "294 (bc_1, p25, output3, x, 293, 0, z)," & "293 (bc_1, *, control, 0)," & "292 (bc_4, p26, observe_only, x)," & "291 (bc_1, p26, output3, x, 290, 0, z)," & "290 (bc_1, *, control, 0)," & "289 (bc_4, p27, observe_only, x)," & "288 (bc_1, p27, output3, x, 287, 0, z)," & "287 (bc_1, *, control, 0)," & "286 (bc_4, p00, observe_only, x)," & "285 (bc_1, p00, output3, x, 284, 0, z)," & "284 (bc_1, *, control, 0)," & "283 (bc_4, p01, observe_only, x)," & "282 (bc_1, p01, output3, x, 281, 0, z)," & "281 (bc_1, *, control, 0)," & "280 (bc_4, p02, observe_only, x)," & "279 (bc_1, p02, output3, x, 278, 0, z)," & "278 (bc_1, *, control, 0)," & "277 (bc_4, p03, observe_only, x)," & "276 (bc_1, p03, output3, x, 275, 0, z)," & "275 (bc_1, *, control, 0)," & "274 (bc_4, p04, observe_only, x)," & "273 (bc_1, p04, output3, x, 272, 0, z)," & "272 (bc_1, *, control, 0)," & "271 (bc_4, p05, observe_only, x)," & "270 (bc_1, p05, output3, x, 269, 0, z)," & "269 (bc_1, *, control, 0)," & "268 (bc_4, p06, observe_only, x)," & "267 (bc_1, p06, output3, x, 266, 0, z)," &
19 19-29 ver.0.10 figure 19.5.15 bsdl description for the 32170 (15/19) jtag 19.5 boundary scan description language "266 (bc_1, *, control, 0)," & "265 (bc_4, p07, observe_only, x)," & "264 (bc_1, p07, output3, x, 263, 0, z)," & "263 (bc_1, *, control, 0)," & "262 (bc_4, p10, observe_only, x)," & "261 (bc_1, p10, output3, x, 260, 0, z)," & "260 (bc_1, *, control, 0)," & "259 (bc_4, p11, observe_only, x)," & "258 (bc_1, p11, output3, x, 257, 0, z)," & "257 (bc_1, *, control, 0)," & "256 (bc_4, p12, observe_only, x)," & "255 (bc_1, p12, output3, x, 254, 0, z)," & "254 (bc_1, *, control, 0)," & "253 (bc_4, p13, observe_only, x)," & "252 (bc_1, p13, output3, x, 251, 0, z)," & "251 (bc_1, *, control, 0)," & "250 (bc_4, p14, observe_only, x)," & "249 (bc_1, p14, output3, x, 248, 0, z)," & "248 (bc_1, *, control, 0)," & "247 (bc_4, p15, observe_only, x)," & "246 (bc_1, p15, output3, x, 245, 0, z)," & "245 (bc_1, *, control, 0)," & "244 (bc_4, p16, observe_only, x)," & "243 (bc_1, p16, output3, x, 242, 0, z)," & "242 (bc_1, *, control, 0)," & "241 (bc_4, p17, observe_only, x)," & "240 (bc_1, p17, output3, x, 239, 0, z)," & "239 (bc_1, *, control, 0)," & "238 (bc_4, p180, observe_only, x)," & "237 (bc_1, p180, output3, x, 236, 0, z)," & "236 (bc_1, *, control, 0)," & "235 (bc_4, p181, observe_only, x)," & "234 (bc_1, p181, output3, x, 233, 0, z)," & "233 (bc_1, *, control, 0)," & "232 (bc_4, p182, observe_only, x)," & "231 (bc_1, p182, output3, x, 230, 0, z)," & "230 (bc_1, *, control, 0)," & "229 (bc_4, p183, observe_only, x)," & "228 (bc_1, p183, output3, x, 227, 0, z)," & "227 (bc_1, *, control, 0)," & "226 (bc_4, p184, observe_only, x)," & "225 (bc_1, p184, output3, x, 224, 0, z)," & "224 (bc_1, *, control, 0)," & "223 (bc_4, p185, observe_only, x)," & "222 (bc_1, p185, output3, x, 221, 0, z)," & "221 (bc_1, *, control, 0)," & "220 (bc_4, p186, observe_only, x)," & "219 (bc_1, p186, output3, x, 218, 0, z)," & "218 (bc_1, *, control, 0)," & "217 (bc_4, p187, observe_only, x)," & "216 (bc_1, p187, output3, x, 215, 0, z)," & "215 (bc_1, *, control, 0)," & "214 (bc_4, p190, observe_only, x)," & "213 (bc_1, p190, output3, x, 212, 0, z)," & "212 (bc_1, *, control, 0)," & "211 (bc_4, p191, observe_only, x)," &
19 19-30 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.16 bsdl description for the 32170 (16/19) "210 (bc_1, p191, output3, x, 209, 0, z)," & "209 (bc_1, *, control, 0)," & "208 (bc_4, p192, observe_only, x)," & "207 (bc_1, p192, output3, x, 206, 0, z)," & "206 (bc_1, *, control, 0)," & "205 (bc_4, p193, observe_only, x)," & "204 (bc_1, p193, output3, x, 203, 0, z)," & "203 (bc_1, *, control, 0)," & "202 (bc_4, p194, observe_only, x)," & "201 (bc_1, p194, output3, x, 200, 0, z)," & "200 (bc_1, *, control, 0)," & "199 (bc_4, p195, observe_only, x)," & "198 (bc_1, p195, output3, x, 197, 0, z)," & "197 (bc_1, *, control, 0)," & "196 (bc_4, p196, observe_only, x)," & "195 (bc_1, p196, output3, x, 194, 0, z)," & "194 (bc_1, *, control, 0)," & "193 (bc_4, p197, observe_only, x)," & "192 (bc_1, p197, output3, x, 191, 0, z)," & "191 (bc_1, *, control, 0)," & "190 (bc_4, p160, observe_only, x)," & "189 (bc_1, p160, output3, x, 188, 0, z)," & "188 (bc_1, *, control, 0)," & "187 (bc_4, p161, observe_only, x)," & "186 (bc_1, p161, output3, x, 185, 0, z)," & "185 (bc_1, *, control, 0)," & "184 (bc_4, p162, observe_only, x)," & "183 (bc_1, p162, output3, x, 182, 0, z)," & "182 (bc_1, *, control, 0)," & "181 (bc_4, p163, observe_only, x)," & "180 (bc_1, p163, output3, x, 179, 0, z)," & "179 (bc_1, *, control, 0)," & "178 (bc_4, p164, observe_only, x)," & "177 (bc_1, p164, output3, x, 176, 0, z)," & "176 (bc_1, *, control, 0)," & "175 (bc_4, p165, observe_only, x)," & "174 (bc_1, p165, output3, x, 173, 0, z)," & "173 (bc_1, *, control, 0)," & "172 (bc_4, p166, observe_only, x)," & "171 (bc_1, p166, output3, x, 170, 0, z)," & "170 (bc_1, *, control, 0)," & "169 (bc_4, p167, observe_only, x)," & "168 (bc_1, p167, output3, x, 167, 0, z)," & "167 (bc_1, *, control, 0)," & "166 (bc_4, p172, observe_only, x)," & "165 (bc_1, p172, output3, x, 164, 0, z)," & "164 (bc_1, *, control, 0)," & "163 (bc_4, p173, observe_only, x)," & "162 (bc_1, p173, output3, x, 161, 0, z)," & "161 (bc_1, *, control, 0)," & "160 (bc_4, p174, observe_only, x)," & "159 (bc_1, p174, output3, x, 158, 0, z)," & "158 (bc_1, *, control, 0)," & "157 (bc_4, p175, observe_only, x)," & "156 (bc_1, p175, output3, x, 155, 0, z)," & "155 (bc_1, *, control, 0)," &
19 19-31 ver.0.10 figure 19.5.17 bsdl description for the 32170 (17/19) jtag 19.5 boundary scan description language "154 (bc_4, p176, observe_only, x)," & "153 (bc_1, p176, output3, x, 152, 0, z)," & "152 (bc_1, *, control, 0)," & "151 (bc_4, p177, observe_only, x)," & "150 (bc_1, p177, output3, x, 149, 0, z)," & "149 (bc_1, *, control, 0)," & "148 (bc_4, p82, observe_only, x)," & "147 (bc_1, p82, output3, x, 146, 0, z)," & "146 (bc_1, *, control, 0)," & "145 (bc_4, p83, observe_only, x)," & "144 (bc_1, p83, output3, x, 143, 0, z)," & "143 (bc_1, *, control, 0)," & "142 (bc_4, p84, observe_only, x)," & "141 (bc_1, p84, output3, x, 140, 0, z)," & "140 (bc_1, *, control, 0)," & "139 (bc_4, p85, observe_only, x)," & "138 (bc_1, p85, output3, x, 137, 0, z)," & "137 (bc_1, *, control, 0)," & "136 (bc_4, p86, observe_only, x)," & "135 (bc_1, p86, output3, x, 134, 0, z)," & "134 (bc_1, *, control, 0)," & "133 (bc_4, p87, observe_only, x)," & "132 (bc_1, p87, output3, x, 131, 0, z)," & "131 (bc_1, *, control, 0)," & "130 (bc_4, p200, observe_only, x)," & "129 (bc_1, p200, output3, x, 128, 0, z)," & "128 (bc_1, *, control, 0)," & "127 (bc_4, p201, observe_only, x)," & "126 (bc_1, p201, output3, x, 125, 0, z)," & "125 (bc_1, *, control, 0)," & "124 (bc_4, p202, observe_only, x)," & "123 (bc_1, p202, output3, x, 122, 0, z)," & "122 (bc_1, *, control, 0)," & "121 (bc_4, p203, observe_only, x)," & "120 (bc_1, p203, output3, x, 119, 0, z)," & "119 (bc_1, *, control, 0)," & "118 (bc_4, p61, observe_only, x)," & "117 (bc_1, p61, output3, x, 116, 0, z)," & "116 (bc_1, *, control, 0)," & "115 (bc_4, p62, observe_only, x)," & "114 (bc_1, p62, output3, x, 113, 0, z)," & "113 (bc_1, *, control, 0)," & "112 (bc_4, p63, observe_only, x)," & "111 (bc_1, p63, output3, x, 110, 0, z)," & "110 (bc_1, *, control, 0)," & "109 (bc_4, p64, observe_only, x)," & "108 (bc_4, p65, observe_only, x)," & "107 (bc_1, p65, output3, x, 106, 0, z)," & "106 (bc_1, *, control, 0)," & "105 (bc_4, p66, observe_only, x)," & "104 (bc_1, p66, output3, x, 103, 0, z)," & "103 (bc_1, *, control, 0)," & "102 (bc_4, p67, observe_only, x)," & "101 (bc_1, p67, output3, x, 100, 0, z)," & "100 (bc_1, *, control, 0)," & "99 (bc_4, p70, observe_only, x)," &
19 19-32 ver.0.10 jtag 19.5 boundary scan description language figure 19.5.18 bsdl description for the 32170 (18/19) "98 (bc_1, p70, output3, x, 97, 0, z)," & "97 (bc_1, *, control, 0)," & "96 (bc_4, p71, observe_only, x)," & "95 (bc_1, p71, output3, x, 94, 0, z)," & "94 (bc_1, *, control, 0)," & "93 (bc_4, p72, observe_only, x)," & "92 (bc_1, p72, output3, x, 91, 0, z)," & "91 (bc_1, *, control, 0)," & "90 (bc_4, p73, observe_only, x)," & "89 (bc_1, p73, output3, x, 88, 0, z)," & "88 (bc_1, *, control, 0)," & "87 (bc_4, p74, observe_only, x)," & "86 (bc_1, p74, output3, x, 85, 0, z)," & "85 (bc_1, *, control, 0)," & "84 (bc_4, p75, observe_only, x)," & "83 (bc_1, p75, output3, x, 82, 0, z)," & "82 (bc_1, *, control, 0)," & "81 (bc_4, p76, observe_only, x)," & "80 (bc_1, p76, output3, x, 79, 0, z)," & "79 (bc_1, *, control, 0)," & "78 (bc_4, p77, observe_only, x)," & "77 (bc_1, p77, output3, x, 76, 0, z)," & "76 (bc_1, *, control, 0)," & "75 (bc_4, p93, observe_only, x)," & "74 (bc_1, p93, output3, x, 73, 0, z)," & "73 (bc_1, *, control, 0)," & "72 (bc_4, p94, observe_only, x)," & "71 (bc_1, p94, output3, x, 70, 0, z)," & "70 (bc_1, *, control, 0)," & "69 (bc_4, p95, observe_only, x)," & "68 (bc_1, p95, output3, x, 67, 0, z)," & "67 (bc_1, *, control, 0)," & "66 (bc_4, p96, observe_only, x)," & "65 (bc_1, p96, output3, x, 64, 0, z)," & "64 (bc_1, *, control, 0)," & "63 (bc_4, p97, observe_only, x)," & "62 (bc_1, p97, output3, x, 61, 0, z)," & "61 (bc_1, *, control, 0)," & "60 (bc_4, reset, observe_only, x)," & "59 (bc_4, mod0, observe_only, x)," & "58 (bc_4, mod1, observe_only, x)," & "57 (bc_4, fp, observe_only, x)," & "56 (bc_4, p110, observe_only, x)," & "55 (bc_1, p110, output3, x, 54, 0, z)," & "54 (bc_1, *, control, 0)," & "53 (bc_4, p111, observe_only, x)," & "52 (bc_1, p111, output3, x, 51, 0, z)," & "51 (bc_1, *, control, 0)," & "50 (bc_4, p112, observe_only, x)," & "49 (bc_1, p112, output3, x, 48, 0, z)," & "48 (bc_1, *, control, 0)," & "47 (bc_4, p113, observe_only, x)," & "46 (bc_1, p113, output3, x, 45, 0, z)," & "45 (bc_1, *, control, 0)," & "44 (bc_4, p114, observe_only, x)," & "43 (bc_1, p114, output3, x, 42, 0, z)," &
19 19-33 ver.0.10 figure 19.5.19 bsdl description for the 32170 (19/19) jtag 19.5 boundary scan description language "42 (bc_1, *, control, 0)," & "41 (bc_4, p115, observe_only, x)," & "40 (bc_1, p115, output3, x, 39, 0, z)," & "39 (bc_1, *, control, 0)," & "38 (bc_4, p116, observe_only, x)," & "37 (bc_1, p116, output3, x, 36, 0, z)," & "36 (bc_1, *, control, 0)," & "35 (bc_4, p117, observe_only, x)," & "34 (bc_1, p117, output3, x, 33, 0, z)," & "33 (bc_1, *, control, 0)," & "32 (bc_4, p100, observe_only, x)," & "31 (bc_1, p100, output3, x, 30, 0, z)," & "30 (bc_1, *, control, 0)," & "29 (bc_4, p101, observe_only, x)," & "28 (bc_1, p101, output3, x, 27, 0, z)," & "27 (bc_1, *, control, 0)," & "26 (bc_4, p102, observe_only, x)," & "25 (bc_1, p102, output3, x, 24, 0, z)," & "24 (bc_1, *, control, 0)," & "23 (bc_4, p210, observe_only, x)," & "22 (bc_1, p210, output3, x, 21, 0, z)," & "21 (bc_1, *, control, 0)," & "20 (bc_4, p211, observe_only, x)," & "19 (bc_1, p211, output3, x, 18, 0, z)," & "18 (bc_1, *, control, 0)," & "17 (bc_4, p212, observe_only, x)," & "16 (bc_1, p212, output3, x, 15, 0, z)," & "15 (bc_1, *, control, 0)," & "14 (bc_4, p213, observe_only, x)," & "13 (bc_1, p213, output3, x, 12, 0, z)," & "12 (bc_1, *, control, 0)," & "11 (bc_4, p214, observe_only, x)," & "10 (bc_1, p214, output3, x, 9, 0, z)," & "9 (bc_1, *, control, 0)," & "8 (bc_4, p215, observe_only, x)," & "7 (bc_1, p215, output3, x, 6, 0, z)," & "6 (bc_1, *, control, 0)," & "5 (bc_4, p216, observe_only, x)," & "4 (bc_1, p216, output3, x, 3, 0, z)," & "3 (bc_1, *, control, 0)," & "2 (bc_4, p217, observe_only, x)," & "1 (bc_1, p217, output3, x, 0, 0, z)," & "0 (bc_1, *, control, 0)"; end m32170f6vfp;
19 19-34 ver.0.10 jtag 19.6 precautions about board design when connecting jtag 19.6 precautions about board design when connecting jtag to materialize fast and highly reliable communication with jtag tools, the jtag pins require that wiring lengths be matched during board design. figure 19.6.1 precautions to be observed when connecting jtag tool (when using the 240qfp) m32r/e jtdi jtms jtck jtrst user board jtag tool make sure wiring lengths are the same, and avoid bending wires as much as possible. also, do not use through-holes within wiring. jtdo 33 w vcce(5v) 2k w 10k w 0.1f sdi connector (jtag connector) power tdi tms tck trst tdo gnd 33 w 10k w 33 w 10k w 33 w 10k w 33 w
19 19-35 ver.0.10 figure 19.6.2 precautions to be observed when connecting jtag tool (when using the 255fbga) jtag 19.6 precautions about board design when connecting jtag aaaa a aa a a aa a a aa a a aa a a aa a a aa a a aa a a aa a a aa a a aa a a aa a a aa a a aa a a aa a aaaa dbi trclk trsync trdata[0:7] event[0:1] dbi trclk trsync when connecting emulator trdata[0:7] event[0:1] 8 2 m32r/e jtdi jtms jtck jtrst when connecting jtag tool jtdo 33 w vcce(5v) 2k w 10k w 0.1f sdi connector (jtag connector) power tdi tms tck trst tdo gnd 33 w 10k w 33 w 10k w 33 w 10k w 33 w user board 33 w 33 w 33 w 33 w 33 w 10k w make sure wiring lengths are the same, and avoid bending wires as much as possible. also, do not use through-holes within wiring.
19 19-36 ver.0.10 jtag 19.6 precautions about board design when connecting jtag * this is a blank page.*
chapter 20 chapter 20 power-up/power- shutdown sequence 20.1 configuration of the power supply circuit 20.2 power-up sequence 20.3 power-shutdown sequence
20 20-2 ver.0.10 power-up/power-shutdown sequence 20.1 configuration of the power supply circuit 20.1 configuration of the power supply circuit to materialize high-speed operation at low power, the m32r/e is designed in such a way that its external interface circuits operate at 5 v power supply and all other circuits operate at 3.3 v. this requires that control timing of both 5 v and 3.3 v power supplies be considered when designing your circuit. figure 20.1.1 configuration of the power supply circuit table 20.1.1 list of power supply functions type of power supply pin name function 5.0 v system vcce supplies power to external i/o ports avcc0, avcc1 power supply for a-d converter vref0, vref1 reference voltage for a-d converter 3.3 v system vcci supplies power to internal logic fvcc power supply for internal flash memory vdd power supply for internal ram backup osc-vcc power supply for oscillator and pll circuits osc-vcc fvcc vdd vcci avcc vcce m32r/e 5 v power supply 3.3 v power supply i/o control circuit a-d converter circuit cpu peripheral circuit flash ram oscillator and pll circuits
20 20-3 ver.0.10 20.2 power-on sequence 20.2.1 power-on sequence when not using ram backup the diagram below shows a power-on sequence (5.0 v, 3.3 v power supply) of the m32r/e when not using ram backup. power-up/power-shutdown sequence 20.2 power-up sequence : turn on the 3.3 v power supply after turning on the 5 v power supply. : ____________ after turning on all power supplies and holding the reset pin low for an oscillation ____________ stabilization time, release the reset pin input back high (to deactivate reset). note: power-on limitations vdd osc-vcc vcci fvcc vcce vcci, fvcc, osc-vcc figure 20.2.1 power-on sequence when not using ram backup vcce avcc0, avcc1 vref0, vref1 reset vdd vcci fvcc osc-vcc 5v 5v 5v 5v 3.3v 3.3v 3.3v 3.3v 0v 0v 0v 0v 0v 0v 0v 0v 2 1
20 20-4 ver.0.10 20.2.2 power-on sequence when using ram backup the diagram below shows a power-on sequence (5.0 v, 3.3 v power supply) of the m32r/e when using ram backup. figure 20.2.2 power-on sequence when using ram backup : turn on the 3.3 v power supply after turning on the 5 v power supply. : ____________ after turning on all power supplies and holding the reset pin low for an oscillation ____________ stabilization time, release the reset pin input back high (to deactivate reset). note: power-on limitations vdd osc-vcc vcci fvcc vcce vcci, fvcc, osc-vcc vcce avcc0, avcc1 vref0, vref1 reset vdd vcci fvcc osc-vcc 5v 5v 5v 5v 3.3v 3.3v 3.3v 3.3v 0v 2.0v 0v 0v 0v 0v 0v 0v 0v 2 1
20 20-5 ver.0.10 20.3 power-shutdown sequence 20.3.1 power-shutdown sequence when not using ram backup the diagram below shows a power-shutdown sequence (5.0 v, 3.3 v power supply) of the m32r/ e when not using ram backup. : ____________ pull the reset pin input low. : ____________ turn off the 5 v and the 3 v power supply after the reset pin goes low. note: power-shutdown requirements vdd vcci fvcc osc-vcc vcci figure 20.3.1 power-shutdown sequence when not using ram backup power-up/power-shutdown sequence 20.3 power-shutdown sequence vcce avcc0, avcc1 vref0, vref1 reset vdd vcci fvcc osc-vcc 5v 5v 5v 5v 3.3v 3.3v 3.3v 3.3v 0v 0v 0v 0v 0v 0v 0v 0v 2 1
20 20-6 ver.0.10 20.3.2 power-shutdown sequence when using ram backup the diagram below shows a power-shutdown sequence (5.0 v, 3.3 v power supply) of the m32r/ e when using ram backup. figure 20.3.2 power-shutdown sequence when using ram backup vcce avcc0, avcc1 vref0, vref1 p72 / hreq reset vdd vcci fvcc osc-vcc 5v 5v 5v 5v 5v 3.3v 3.3v 3.3v 3.3v 0v 0v 0v 0v 0v 0v 0v 0v 2.0v 2 1 3 3 4 : __________ pull the hreq pin input low to halt the cpu at end of bus cycle. or disable ram access in software. the m32r/e allows p72 to be used as hreq irrespective of its operation mode. : ____________ with the cpu halted, pull the reset pin input low. or while ram access is disabled, pull ____________ the reset pin input low. a : ____________ turn off the 5 v and the 3.3 v power supply after the reset pin goes low. ? : reduce the vdd voltage from 3.3 v to 2.0 v as necessary. note: power-shutdown requirements vdd vcci fvcc osc-vcc vcci
20 20-7 ver.0.10 figure 20.3.3 microcomputer ready to run state (vcce = 5 v, vcci system = 3.3 v, vdd = 3.3 v) figure 20.3.4 cpu reset state power-up/power-shutdown sequence 20.3 power-shutdown sequence osc-vcc fvcc vdd vcci avcc vcce m32r/e 5v power supply 3.3v power supply i/o control circuit a-d converter circuit cpu peripheral circuits flash ram oscillator and pll circuits 5v 3.3v osc-vcc fvcc vdd vcci avcc vcce m32r/e i/o control circuit a-d converter circuit cpu peripheral circuits flash ram oscillator and pll circuits 0v 3.3v 5v power supply 3.3v power supply
20 20-8 ver.0.10 figure 20.3.5 cpu halt state figure 20.3.6 sram data backup state power-up/power-shutdown sequence 20.3 power-shutdown sequence osc-vcc fvcc vdd vcci avcc vcce m32r/e 0v 5v i/o control circuit a-d converter circuit cpu peripheral circuits flash ram oscillator and pll circuits 5v power supply 3.3v power supply osc-vcc fvcc vdd vcci avcc vcce m32r/e 0v 0v 3.3v-2.0v i/o control circuit a-d converter circuit cpu peripheral circuits flash ram oscillator and pll circuits 5v power supply 3.3v power supply
chapter 21 chapter 21 electrical characteristics 21.1 absolute maximum ratings 21.2 recommended operating conditions 21.3 dc characteristics 21.4 a-d conversion characteristics 21.5 ac characteristics
21 21-2 ver.0.10 preliminary preliminary ta=-40 to 85? ta=-40 to 125? symbol parameter condition unit vcci v vdd ram power supply voltage v avcc analog power supply voltage v osc-vcc pll power supply voltage v vref analog reference voltage v fvcc flash power supply voltage v vi xin, vcnt vo pd power dissipation mw topr operating ambient temperature (note) ? tstg storage temperature ? v internal logic power supply voltage vdd vcci fvcc=osc?cc -0.3 to 4.2 vcce external i/o buffer voltage vcce avcc vref xout -0.3 to 6.5 -40 to 125 -65 to 150 -0.3 to osc?cc+0.3 -0.3 to vcce+0.3 -0.3 to osc?cc+0.3 600 -0.3 to vcce+0.3 v v other other -0.3 to 4.2 -0.3 to 4.2 -0.3 to 4.2 -0.3 to 6.5 -0.3 to 6.5 rated value mw 500 vdd vcci fvcc=osc?cc vdd vcci fvcc=osc?cc vdd vcci fvcc=osc?cc vcce avcc vref vcce avcc vref electrical characteristics 21.1 absolute maximum ratings 21.1 absolute maximum ratings absolute maximum ratings (guaranteed for operation at -40 to 125c) note: this does not guarantee that the device can operate continuously at 125c. if you are considering the use of this product in 125c application, please consult mitsubishi.
21 21-3 ver.0.10 preliminary preliminary 21.2 recommended operating conditions recommended operating conditions (referenced to vcce = 5 v 0.5 v, vcci = 3.3 v 0.3 v, ta = -40 to 85c unless otherwise noted) note 1: subject to conditions vcce avcc vref. note 2: subject to conditions vdd vcci fvcc = osc-vcc note 3: make sure the total (peak) output current of ports is | ports p0 + p1 | 80 ma | ports p2 + p3 | 80 ma | ports p4 + p15 | 80 ma | ports p6 + p7 | 80 ma | ports p8 + p20 + p22 | 80 ma | ports p9 + p11 | 80 ma | ports p12 + p13 + p14 | 80 ma | ports p16 + p17 | 80 ma | ports p18 + p19 | 80 ma note 4: the average output current is a value averaged during a 100 ms period. electrical characteristics 21.2 recommended operating conditions symbol parameter rated value unit vcce external i/o buffer power supply voltage (note1) v vdd ram power supply voltage (note2) avcc analog power supply voltage (note1) vref analog reference voltage (note1) vih input high voltage min typ max vil input low voltage ioh(peak) ioh(avg) iol(peak) iol(avg) ma ma ma ma mhz f(xin) fvcc flash power supply voltage (note2) pll power supply voltage (note2) osc-vcc vcci internal logic power supply voltage (note2) 4.5 5.0 5.5 3.0 3.3 3.6 3.3 5.0 3.3 5.0 ports p0, p1 (external extension/ processor mode only), wait 0.8vcce vcce 0.43vcce vcce ports p0-p22, reset, mod0, mod1, fp 0.2vcce 0 0 0.16vcce ports p0, p1 (external extension/ processor mode only), wait low state peak output current p0-p22 (note 3) external clock input frequency 5 -10 10 3.3 v v v v v v v v v v ports p0-p22, reset, mod0, mod1, fp 3.0 3.0 5.5 3.6 -5 10 5 high state peak output current p0-p22 (note 3) cl output load capacitance 80 pf jtck,jtdi,jtms, jtdo,jtrst other than above 100 pf high state average output current p0-p22 (note4) low state average output current p0-p22 (note 4) 3.0 4.5 3.6 3.6 5.5
21 21-4 ver.0.10 preliminary preliminary electrical characteristics 21.2 recommended operating conditions recommended operating conditions (referenced to vcce = 5 v 0.5 v, vcci = 3.3 v 0.3 v, ta = -40 to 125c unless otherwise noted) note 1: subject to conditions vcce avcc vref. note 2: subject to conditions vdd vcci fvcc = osc-vcc note 3: make sure the total (peak) output current of ports is | ports p0 + p1 | 80 ma | ports p2 + p3 | 80 ma | ports p4 + p15 | 80 ma | ports p6 + p7 | 80 ma | ports p8 + p20 + p22 | 80 ma | ports p9 + p11 | 80 ma | ports p12 + p13 + p14 | 80 ma | ports p16 + p17 | 80 ma | ports p18 + p19 | 80 ma note 4: the average output current is a value averaged during a 100 ms period. symbol parameter rated value unit vcce external i/o buffer power supply voltage (note 1) v vdd ram power supply voltage (note 2) avcc analog power supply voltage (note 1) vref analog reference voltage (note 1) vih input high voltage min typ max vil input low voltage ioh(peak) ioh(avg) iol(peak) iol(avg) ma ma ma ma mhz f(xin) fvcc flash power supply voltage (note 2) pll power supply voltage (note 2) osc-vcc vcci internal logic power supply voltage (note 2) 4.5 5.0 5.5 3.0 3.3 3.6 3.3 5.0 3.3 5.0 ports p0, p1 (external extension/ processor mode only), wait 0.8vcce vcce 0.43vcce vcce ports p0-p22, reset, mod0, mod1, fp 0.2vcce 0 0 0.16vcce ports p0, p1 (external extension/ processor mode only), wait low state peak output current p0-p22 (note 3) external clock input frequency 5 -10 8 3.3 v v v v v v v v v v ports p0-p22, reset, mod0, mod1, fp 3.0 3.0 5.5 3.6 -5 10 5 high state peak output current p0-p22 (note 3) cl output load capacitance 80 pf jtck,jtdi,jtms, jtdo,jtrst other than above 100 pf high state average output current p0-p22 (note 4) low state average output current p0-p22 (note 4) 3.0 4.5 3.6 3.6 5.5
21 21-5 ver.0.10 preliminary preliminary 21.3 dc characteristics 21.3.1 electrical characteristics (1) electrical characteristics when f(xin) = 10 mhz (referenced to vcce = 5 v 0.5v, vcci = 3.3 v 0.3 v, ta = -40 to 85c unless otherwise noted) note 1: total current when vcce = avcc = vref in single-chip mode. see the next page for the rated values of power supply current on each power supply pin. note 2: total current when vcci = vdd = fvcc = osc-vcc in single-chip mode. see the next page for the rated values of power supply current on each power supply pin. note 3: ____________ all these pins except reset serve dual-functions. note 4: __________ the hreq pin serves dual-functions. electrical characteristics 21.3 dc characteristics icc-5v 5 v power supply (note 1) 100 2000 f(xin)=10.0mhz, when reset ta=25? ta=85? 1 iddhold see ram retention power supply current characteristic graph 110 icci-3v 3.3 v power supply (note 2) 75 125 75 voh output high voltage v vdd ram retention power supply voltage v iih m a iil vol output low voltage v vcce-1 0.45 vcci ioh= -2ma iol=2ma vi=vcce vi=0v 3.0 2.0 -5 -5 high state input current low state input current 3.6 5 5 m a vcce 0 symbol parameter rated value unit min typ max condition v v t + ?v t - hysteresis (note 3) adtrg, rtdclk, rtdrxd, sclki0,1,2,3, rxd0, 1,2,3,4,5, tclk3-0, jtms,jtrst, jtdi, tin0-33, reset, fp, mod0,1 1.0 vcce=5v v t + ?v t - hysteresis (note 4) sbi, hreq vcce=5v 0.3 v m a ma ma f(xin)=10.0mhz, when operating ram retention power supply current when operating when back-up f(xin)=10.0mhz, when reset f(xin)=10.0mhz, when operating
21 21-6 ver.0.10 preliminary preliminary (2) electrical characteristics of each power supply pin when f(xin) = 10 mhz (referenced to vcce = 5 v 0.5v, vcci = 3.3 v 0.3 v, ta = -40 to 85c unless otherwise noted) ivref ma ma icce vcce power supply current when operating f(xin)=10.0mh z icci ioscvcc idd 35 iavcc ma ma ma 10 120 20 3 1 50 ficc ma vcci power supply current when operating oscvcc power supply current when operating fvcc power supply current when operating (note 1) vdd power supply current when operating (note 2) avcc power supply current when operating vref power supply current symbol rated value unit min typ max condition f(xin)=10.0mh z f(xin)=10.0mh z f(xin)=10.0mh z f(xin)=10.0mh z f(xin)=10.0mh z f(xin)=10.0mh z parameter note 1: maximum value including currents during program/erase operation. note 2: maximum value including cases where the program is executed in ram. electrical characteristics 21.3 dc characteristics
21 21-7 ver.0.10 preliminary preliminary electrical characteristics 21.3 dc characteristics (3) electrical characteristics when f(xin) = 8 mhz (referenced to vcce = 5 v 10%, vcci = 3.3 v 0.3 v, ta = -40 to 125c unless otherwise noted) note 1: total current when vcce = avcc = vref in single-chip mode. see the next page for the rated values of power supply current on each power supply pin. note 2: total current when vcci = vdd = fvcc = osc-vcc in single-chip mode. see the next page for the rated values of power supply current on each power supply pin. note 3: ____________ all these pins except reset serve dual-functions. note 4: __________ the hreq pin serves dual-functions. icc-5v 5 v power supply (note 1) 100 7500 f(xin)=8.0mhz, when reset ta=25? ta=125? 1 iddhold see ram retention power supply current characteristic graph 110 icci-3v 3.3 v power supply (note 2) 60 110 70 voh output high voltage v vdd ram retention power supply voltage v iih m a iil vol output low voltage v vcce-1 0.45 vcci ioh= -2ma iol=2ma vi=vcce vi=0v 3.0 2.0 -5 -5 high state input current low state input current 3.6 5 5 m a vcce 0 symbol parameter rated value unit min typ max condition v v t + ?v t - hysteresis (note 3) adtrg, rtdclk, rtdrxd, sclki0,1,2,3, rxd0, 1,2,3,4,5, tclk3-0, jtms,jtrst, jtdi, tin0-33, reset, fp, mod0,1 1.0 vcce=5v v t + ?v t - hysteresis (note 4) sbi, hreq vcce=5v 0.3 v m a ma ma ram retention power supply current f(xin)=8.0mhz, when operating when operating when back-up f(xin)=8.0mhz, when reset f(xin)=8.0mhz, when operating
21 21-8 ver.0.10 preliminary preliminary (4) electrical characteristics of each power supply pin when f(xin) = 8 mhz (referenced to vcce = 5 v 0.5v, vcci = 3.3 v 0.3 v, ta = -40 to 125c unless otherwise noted) note 1: maximum value including currents during program/erase operation. note 2: maximum value including cases where the program is executed in ram. electrical characteristics 21.3 dc characteristics ivref ma ma icce vcce power supply current when operating f(xin)=8.0mh z icci ioscvcc idd 30 iavcc ma ma ma 10 105 16 3 1 50 ficc ma vcci power supply current when operating oscvcc power supply current when operating fvcc power supply current when operating (note 1) vdd power supply current when operating (note 2) avcc power supply current when operating vref power supply current symbol rated value unit min typ max condition parameter f(xin)=8.0mh z f(xin)=8.0mh z f(xin)=8.0mh z f(xin)=8.0mh z f(xin)=8.0mh z f(xin)=8.0mh z
21 21-9 ver.0.10 preliminary preliminary electrical characteristics 21.3 dc characteristics ram retention power supply current in a standard sample (reference value) 1 10 100 1000 12 3 4 1.5 3.6 ta=25? ta=85? ta=125? idd [a] vdd [v]
21 21-10 ver.0.10 preliminary preliminary 21.3.2 flash related electrical characteristics flash related electrical characteristics (referenced to vcce = 5 v 0.5 v, vcci = 3.3 v 0.3 v unless otherwise noted) ifvcc1 fvcc power supply current (when programming) ma lfvcc2 fvcc power supply current (when erasing) ma 50 40 flash rewrite ambient temperature topr 070 ? cycle rewrite durability 100 times symbol parameter rated value unit min typ max condition electrical characteristics 21.3 dc characteristics
21 21-11 ver.0.10 preliminary preliminary 21.4 a-d conversion characteristics a-d conversion characteristics (referenced to avcc = vref = vcce = 5.12 v, ta = 25c, f(xin) = 10.0 mhz unless otherwise noted) note 1: the nonlinearity error refers to a deviation from ideal conversion characteristics after the offset/ full-scale errors have been adjusted to 0. when avcc = vref = 5.12 v, 1 lsb = 5 mv. note 2: this refers to input leakage current on an0-an15 when the a-d converter remains idle. input voltage condition: 0 ani avcc. temperature condition: -40 to 85c. a-d conversion characteristics (referenced to avcc = vref = vcce = 5.12 v, ta = 25c, f(xin) = 8.0 mhz unless otherwise noted) electrical characteristics 21.4 a-d conversion characteristics resolution bits absolute accuracy (note 1) lsb offset error lsb 10 ? ? full-scale error lsb tconv conversion time number of internal peripheral clock ? 299 iian analog input leakage current na -200 200 (note 2) during normal mode during double- speed mode 173 vref=vcc symbol parameter rated value unit min typ max condition note 1: the nonlinearity error refers to a deviation from ideal conversion characteristics after the offset/ full-scale errors have been adjusted to 0. when avcc = vref = 5.12 v, 1 lsb = 5 mv. note 2: this refers to input leakage current on an0-an15 when the a-d converter remains idle. input voltage condition: 0 ani avcc. temperature condition: -40 to 125c. resolution bits absolute accuracy (note 1) lsb offset error lsb 10 ? ? full-scale error lsb tconv conversion time ? 299 iian analog input leakage current na -200 200 (note 2) during normal mode during double- speed mode 173 vref=vcc symbol parameter rated value unit min typ max condition number of internal peripheral clock
21 21-12 ver.0.10 preliminary preliminary (3) sbi t w(sbil) sbi input pulse width ns 13 tc(bclk) 2 5 see figure 21.5.3 symbol parameter rated value unit min max condition 21.5 ac characteristics 21.5.1 timing requirements ? unless otherwise noted, timing conditions are vcce = 5 v 0.5 v, vcci = 3.3 v 0.3 v, ta = -40 to 125c ? the characteristic values apply to the case of concentrated capacitance with an output load capacitance of 15 to 50 pf (however, 80 pf for jtag-related). in cases where the output load capacitance varies, they may deviate from the rated switching characteristics. (1) input/output ports (2) serial i/o a) csio mode, with internal clock selected b) csio mode, with external clock selected t su(d-clk) rxd input setup time ns 150 4 t h(clk-d) ns 50 5 rxd input hold time t c(clk) clk input cycle time ns 640 7 t w(clkh) ns 300 8 clk input high pulse width t w(clkl) ns 300 9 clk input low pulse width t su(d-clk) ns 60 10 rxd input setup tim t h(clk-d) ns 11 rxd input hold time 100 see figure 21.5.2 symbol parameter rated value unit min max condition see figure 21.5.2 symbol parameter rated value unit min max condition electrical characteristics 21.5 ac characteristics ns t su (p-e) t h (e-p) port input setup time port input hold time 100 0 ns see figure 21.5.1 1 2 symbol parameter rated value unit min max condition
21 21-13 ver.0.10 preliminary preliminary (4) tini (i=0-25) (5) read and write timing t w(tini) tini input pulse width ns 14 tc(bclk) 2 7 see figure 21.5.5 symbol parameter rated value unit min max condition electrical characteristics 21.5 ac characteristics t su(d-bclkh) data input setup time before bclk ns 31 data input hold time after bclk t h(bclkh-d) 26 0 ns 32 see figure 21.5.6 21.5.7 21.5.8 symbol parameter rated value unit min max condition t su(waitl-bclkh) wait input setup time before bclk ns 33 wait input hold time after bclk t h(bclkh-waitl) 26 0 ns 34 t su(waith-bclkh) wait input setup time before bclk ns 78 wait input hold time after bclk t h(bclkh-waith) 26 0 ns 79 t w(blwl) write low pulse width (byte write mode) ns 51 tc(bclk) -25 t w(bhwl) t w(rdl) read low pulse width ns 43 data input setup time before read t su(d-rdh) 30 ns 44 data input hold time after read t h(rdh-d) 45 ns 0 tc(bclk) 2 -23 3 t d(rdh-blwl) write delay time after read ns 56 tc(bclk) -10 t d(rdh-bhwl) 2 t d(blwh-rdl) read delay time after write ns 57 tc(bclk) -10 t d(bhwh-rdl) 2 write low pulse width (byte enable mode) ns 68 t w(wrl) t d(rdh-blel) write delay time after read (byte enable mode) ns 80 tc(bclk) -10 t d(rdh-bhel) 2 read delay time after write (byte enable mode) ns 81 tc(bclk) -10 2 tc(bclk) -25 t d(bleh-rdl) t d(bheh-rdl)
21 21-14 ver.0.10 preliminary preliminary (7) input transition time on jtag pin note: stipulated values are guaranteed values when the test pin load capacitance cl=80pf. (8) jtag interface timing t c(jtck) jtck input cycle time ns jtck input high pulse width t w(jtckh) ns 61 t w(jtckl) ns 62 jtdi, jtms input setup time t su(jtdi-jtck) ns 63 jtdi, jtms input hold time t h(jtck-jtdi) ns 64 ns 65 66 jtck input low pulse width ns 67 t d(jtck-jtdov) t d(jtck-jtdox) t w(jtrst) jtdo output delay time after jtck fall jtdo output hi-z delay time after jtck fall trst input low pulse width 100 40 40 15 20 40 40 60 tc(jtck) ns see figure 21.5.11 symbol rated value unit min max condition t r ns 58 ns input rising transition time t f ns ns 59 input falling transition time other than jtrst pin jtrst pin other than jtrst pin jtrst pin (jtck,jtdi,jtms,jtdo) when using tap when not using tap (jtck,jtdi,jtms,jtdo) 10 10 2 10 10 2 ms ms see figure 21.5.10 symbol rated value unit min max condition when using tap when not using tap (6) bus arbitration timing electrical characteristics 21.5 ac characteristics t su(hreql-bclkh) hreq input setup time before bclk ns 35 hreq input hold time after bclk t h(bclkh-hreql) 27 0 ns 36 see figure 21.5.9 symbol parameter rated value unit min max condition note: stipulated values are guaranteed values when the test pin load capacitance cl=80pf.
21 21-15 ver.0.10 preliminary preliminary 21.5.2 switching characteristics (1) input/output ports (2) serial i/o a) csio mode, with internal clock selected b) csio mode, with external clock selected (3) toi (i=0-44) electrical characteristics 21.5 ac characteristics t d(e-p) port data output delay time ns 100 3 see figure 21.5.1 symbol parameter rated value unit min max condition t d(clk-d) txd output delay time 12 t d(clk-d) txd output delay time ns 160 6 ns 160 see figure 21.5.2 symbol parameter rated value unit min max condition see figure 21.5.2 symbol parameter rated value unit min max condition t d(bclk-toi) toi output delay time 100 ns 15 see figure 21.5.4 symbol parameter rated value unit min max condition
21 21-16 ver.0.10 preliminary preliminary (4) read and write timing electrical characteristics 21.5 ac characteristics t c(bclk) bclk output cycle time ns 16 bclk output high pulse width t w(bclkh) ns 17 tc(xin) 2 t w(bclkl) ns 18 tc(bclk) 2 - 5 address delay time after bclk t d(bclkh-a) ns 19 chip select delay time after bclk t d(bclkh-cs) ns 20 valid address time after bclk t v(bclkh-a) ns 21 valid chip select time after bclk t v(bclkh-cs) ns 22 read delay time after bclk t d(bclkl-rdl) ns 23 valid read time after bclk t v(bclkh-rdl) ns 24 write delay time after bclk ns 25 valid write time after bclk ns 26 data output delay time after bclk t d(bclkl-d) ns 27 valid data output time after bclk t v(bclkh-d) ns 28 data output enable time after bclk t pzx(bclkl-dz) ns 29 bclk output low pulse width data output disable time after bclk t pxz(bclkh-dz) ns 30 -11 -11 -12 -12 -16 -19 24 24 10 11 t d(bclkl-blwl) t d(bclkl-bhwl) t v(bclkl-bhwl) t v(bclkl-blwl) 18 tc(bclk) 2 - 5 5 see figure 21.5.6 21.5.7 21.5.8 symbol parameter rated value unit min max condition t d(a-rdl) ns 39 chip select delay time before read t d(cs-rdl) ns 40 valid address time after read t v(rdh-a) 41 ns 0 tc(bclk) 2 -15 valid chip select time after read t v(rdh-cs) 42 ns 0 data output enable time after read t pzx(rdh-dz) 46 ns tc(bclk) 2 -15 tc(bclk) 2 address delay time before read t d(a-blwl) address delay time before write (byte write mode) ns 47 chip select delay time before write (byte write mode) ns 48 valid address time after write (byte write mode) 49 ns tc(bclk) 2 -15 valid chip select time after write (byte write mode) 50 ns tc(bclk) 2 -15 t d(a-bhwl) t d(cs-blwl) t d(cs-bhwl) t v(blwh-a) t v(bhwh-a) t v(blwh-cs) t v(bhwh-cs) tc(bclk) 2 -15 tc(bclk) 2 -15
21 21-17 ver.0.10 preliminary preliminary (5) bus arbitration electrical characteristics 21.5 ac characteristics t d(bclkl-hackl) hack delay time after bclk ns 37 valid hack time after bclk t v(bclkl-hackl) 29 -11 ns 38 see figure 21.5.9 symbol parameter rated value unit min max condition read and write timing (continued from the preceding page) 52 data output delay time after write (byte write mode) ns t d(blwl-d) t d(bhwl-d) 15 tc(bclk) 2 -13 valid data output time after write (byte write mode) t v(blwh-d) t v(bhwh-d) 53 ns see figure 21.5.6 21.5.7 21.5.8 symbol parameter rated value unit min max condition tc(bclk) 2 +5 data output disable time after write (byte write mode) t pxz(blwh-dz) t pxz(bhwh-dz) 54 ns tc(bclk) 2 -15 address delay time before write (byte enable mode) t d(a-wrl) 69 ns chip select delay time before write (byte enable mode) t d(cs-wrl) 70 ns valid address time after write (byte enable mode) t v(wrh-a) 71 ns valid chip select time after write (byte enable mode) t v(wrh-cs) 72 ns byte enable delay time before write (byte enable mode) t d(ble-wrl) t d(bhe-wrl) 73 ns byte enable delay time after write (byte enable mode) t v(wrh-ble) t v(wrh-bhe) 74 ns 75 data output delay time after write (byte enable mode) ns t d(wrl-d) 15 tc(bclk) 2 -13 valid data output time after write (byte enable mode) t v(wrh-d) 76 ns data output disable time after write (byte enable mode) t pxz(wrh-dz) ns 77 tc(bclk) 2 -3 read high-level pulse width t w(rdh) ns 55 tc(bclk) 2 -15 tc(bclk) 2 -15 tc(bclk) 2 -15 tc(bclk) 2 -15 tc(bclk) 2 -15 tc(bclk) 2 +5
21 21-18 ver.0.10 preliminary preliminary 21.5.3 ac characteristics figure 21.5.1 input/output port timing electrical characteristics 21.5 ac characteristics port output td(e-p) 0.8vcce 0.2vcce bclk 0.8vcce 0.2vcce 0.8vcce 0.2vcce port input 0.2vcce 0.8vcce tsu(p-e) th(e-p) 1 2 3 a) csio mode, with internal clock selected b) csio mode, with external clock selected clk out txd rxd td(clk-d) tsu(d-clk) th(clk-d) 0.8vcce 0.2vcce 0.2vcce 0.8vcce 0.2vcce 0.8vcce clk in txd rxd td(clk-d) tsu(d-clk) th(clk-d) 0.8vcce 0.2vcce 0.2vcce 0.8vcce 0.2vcce 0.8vcce 0.2vcce 0.8vcce tc(clk) tw(clkh) tw(clkl) 4 5 6 7 8 12 10 11 9 0.8vcce 0.2vcce figure 21.5.2 serial i/o timing
21 21-19 ver.0.10 preliminary preliminary sbi tw(sbil) 0.2vcce 0.2vcce 13 bclk toi td(bclk-toi) 0.8vcce 0.2vcce 0.2vcce 15 tini 0.8vcce 0.2vcce 0.8vcce 0.2vcce tw(tini) 14 electrical characteristics 21.5 ac characteristics figure 21.5.3 sbi timing figure 21.5.4 toi timing figure 21.5.5 tini timing
21 21-20 ver.0.10 preliminary preliminary electrical characteristics 21.5 ac characteristics figure 21.5.6 read timing note 1: stipulated values are guaranteed values when the test pin load capacitance cl = 15 to 50 pf. note 2: input and output signals are determined high or low with respect to ttl level. tsu(waith-bclkh) bclk tc(bclk) blw bhw tw(bclkl) tw(bclkh) rd tv(bclkh-rdl) 18 17 16 21 22 24 0.16vcce address (a11-a30) cs0, cs1 0.43vcce 0.16vcce 0.43vcce 0.16vcce wait tsu(waitl-bclkh) 0.16vcce 0.16vcce tpzx(bclkl-dz) 0.16vcce td(bclkl-rdl) tsu(d-rdh) th(rdh-d) tv(rdh-a) tv(rdh-cs) tpzx(rdh-dz) td(cs-rdl) td(a-rdl) 44 45 46 tw(rdl) th(bclkh-d) tw(rdh) 0.43vcce tsu(d-bclkh) td(bhwh-rdl) td(blwh-rdl) td(rdh-bhwl) td(rdh-blwl) 56 0.16vcce td(bclkh-a) td(bclkh-cs) 42 43 23 19 20 40 39 55 57 31 32 29 33 34 tpxz(bclkh-dz) 30 tv(bclkh-a) tv(bclkh-cs) 41 0.43vcce 0.16vcce 0.43vcce 0.43vcce th(bclkh-waitl) 78 79 th(bclkh-waith) 0.43vcce 0.43vcce data output (d0-d15) data input (d0-d15)
21 21-21 ver.0.10 preliminary preliminary figure 21.5.7 write timing note 1: stipulated values are guaranteed values when the test pin load capacitance cl = 15 to 50 pf. note 2: input and output signals are determined high or low with respect to ttl level. electrical characteristics 21.5 ac characteristics address (a12-a30) cs0, cs1 tsu(waith-bclkh) tsu(waitl-bclkh) bclk tc(bclk) blw bhw tw(bclkl) tw(bclkh) tpxz(bclkh-dz) td(bclkl-bhwl) rd 18 17 16 21 22 0.43vcce 0.16vcce 0.16vcce 0.16vcce 0.43vcce 0.16vcce wait 0.16vcce 0.16vcce td(bclkl-d) tpzx(bclkl-dz) tv(bclkh-d) tpxz(blwh-dz) tv(blwh-d) td(cs-blwl) tw(bhwl) tv(bhwh-d) tpxz(bhwh-dz) td(cs-bhwl) td(a-blwl) td(a-bhwl) tw(blwl) tv(blwh-a) tv(bhwh-a) tv(blwh-cs) tv(bhwh-cs) 54 53 td(bclkh-a) td(bclkh-cs) 19 20 57 47 48 51 49 50 25 26 28 29 27 30 33 34 td(bclkl-blwl) 0.16vcce td(bclkl-rdl) 23 0.16vcce 0.43vcce 0.43vcce td(rdh-bhwl) td(rdh-blwl) 56 td(bhwl-d) td(blwl-d) 52 0.43vcce 0.16vcce tv(bclkh-a) tv(bclkh-cs) td(bhwh-rdl) td(blwh-rdl) tv(bclkl-bhwl) tv(bclkl-blwl) 0.43vcce 0.43vcce th(bclkh-waitl) 78 79 th(bclkh-waith) data output (d0-d15)
21 21-22 ver.0.10 preliminary preliminary electrical characteristics 21.5 ac characteristics figure 21.5.8 write timing (byte enable mode) figure 21.5.9 bus arbitration timing note 1: stipulated values are guaranteed values when the test pin load capacitance cl = 15 to 50 pf. note 2: input and output signals are determined high or low with respect to ttl level. 0.43vcce 0.16vcce 0.43vcce 0.16vcce rd address (a11-a30) cs0, cs1 0.43vcce 0.16vcce 0.16vcce 0.43vcce 0.43vcce 0.16vcce td(wrl-d) tpxz(wrh-dz) tv(wrh-d) 71 72 77 75 76 0.16vcce 0.16vcce ble , bhe wr tw(wrl) 68 73 74 69 70 td(bhel-wrl) td(blel-wrl) 0.16vcce 0.43vcce td(rdh-bhel) td(rdh-blel) td(bheh-rdl) td(bleh-rdl) tv(wrh-a) tv(wrh-cs) tv(wrh-blel) tv(wrh-bhel) td(cs-wrl) td(a-wrl) 80 81 data output (d0-d15) tsu(hreql-bclkh) bclk hack th(bclkh-hreql) td(bclkl-hackl) tv(bclkl-hackl) hreq 35 36 37 38 0.16vcce 0.16vcce 0.43vcce 0.16vcce 0.16vcce 0.16vcce
21 21-23 ver.0.10 preliminary preliminary electrical characteristics 21.5 ac characteristics jtck 0.5vcce tc(jtck) 60 tw(jtckh) tsu(jtdi-jtck) th(jtck-jtdi) 64 63 td(jtck-jtdov) td(jtck-jtdox) tw(jtrst) data input, (jtdi) jtms data output, (jtdo) jtrst tw(jtckl) 61 65 66 67 0.8vcce 0.2vcce 0.8vcce 0.2vcce 0.8vcce 0.2vcce 62 0.2vcce 0.2vcce 0.8vcce 0.2vcce jtck,jtdi jtms,jrst tr tf 0.8vcce 0.2vcce 58 59 0.8vcce 0.2vcce figure 21.5.10 input transition time on jtag pins figure 21.5.11 jtag interface timing note: stipulated values are guaranteed values when the test pin load capacitance cl = 80 pf. note: stipulated values are guaranteed values when the test pin load capacitance cl = 80 pf.
21 21-24 ver.0.10 preliminary preliminary j this is a blank page. j electrical characteristics 21.5 ac characteristics
chapter 22 chapter 22 typical characteristics 22.1 a-d conversion characteristics
22 22-2 ver.0.10 internal memory 22.1 a-d conversion characteristics 22.1 a-d conversion characteristics (1) test conditions ? ta = -40c, 27c, 125c ? test voltage (vcc) = 5.12 v ? double-speed mode (2) measured value (reference value) vertical axis : conversion error horizontal axis : analog input voltage ( 5.12 n/1024 [v] ) ta = -40c ta = 27c ta = 125c
appendix 1.1 dimensional outline drawing appendix 1 appendix 1 mechanical specifications
appendix 1 appendix 1-2 ver.0.10 mechanical specifications appendix 1.1 dimensional outline drawing appendix 1.1 dimensional outline drawing (1) 240-pin qfp qfp240-p-3232-0.50 weight(g) e jedec code eiaj package code lead material cu alloy 240p6y-a plastic 240pin 32 32mm body qfp e 0.35 e ee 0.45 e e ee e e e e e symbol min nom max a a 2 b c d e h e l l 1 y b 2 dimension in millimeters h d a 1 0.225 e e i 2 1.2 e e m d 32.6 e e m e 32.6 10 0 0.1 1.3 0.7 0.5 0.3 34.8 34.6 34.4 34.8 34.6 34.4 0.5 32.1 32.0 31.9 32.1 32.0 31.9 0.2 0.15 0.13 0.3 0.2 0.15 3.6 0.25 4.1 e e e e c h e 1 60 61 h d d m d m e a f b a 1 a 2 l 1 l y b 2 i 2 recommended mount pad detail f 240 120 121 180 181
appendix 1 appendix 1-3 ver.0.10 mechanical specifications appendix 1.1 dimensional outline drawing (2) 255-pin fbga 1234567891011121314151617181920 weight(g) e e jedec code eiaj package code 255f7f 255pin 17 17mm body fbga 0.8 19=15.2 a 0.8typ 17typ 0.8 19=15.2 0.8typ b 1.2max c 0.1 c 0.35 0.05 (16.6) 17typ (16.6) 0.20 c b 0.2 5 4 255- f 0.45 0.05 f 0.08 c m a b under development 0.20 ca y w v u t r p n m l k j h g f e d c b a recommended mount pad 255fbga note : 255fbga is currently under development. 0.32mm 0.3mm metal wiring (cu pattern) ni/au plating via solder resist cu pattern [p.c.b.side] [package side]
appendix 1 appendix 1-4 ver.0.10 mechanical specifications appendix 1.1 dimensional outline drawing j this is a blank page. j
appendix 2.1 32170 instruction processing time appendix 2 appendix 2 instruction processing time
appendix 2 appendix 2-2 ver.0.10 instruction processing time appendix 2.1 32170 instruction processing time appendix 2.1 32170 instruction processing time for the m32r, the number of instruction execution cycles in e stage normally represents its instruction processing time. however, depending on pipeline operation, other stages may affect the instruction processing time. especially when a branch instruction is executed, the processing time in if (instruction fetch) and d (decode) stages, not just e (execution) stage, must also be taken into account. the table below shows the instruction processing time in each pipelined stage of the m32r. table 2.1.1 instruction processing time of each pipeline stage number of execution cycles in each stage (note 1) instruction if d e mem wb load instructions (ld, ldb, ldub, ldh, lduh, lock) r 1 1 r 1 store instructions (st,stb,sth,unlock) r 1 1 w - multiply instruction (mul) r 1 3 - 1 divide/remainder instructions (div, divu,rem,remu) r 1 37 - 1 other instructions (including those for dsp function) r 1 1 - 1 note: for r and w, refer to the calculation methods described in the next page.
appendix 2 appendix 2-3 ver.0.10 instruction processing time appendix 2.1 32170 instruction processing time the following shows the number of memory access cycles in if and mem stages. shown here are the minimum number of cycles required for memory access. therefore, these values do not always reflect the number of cycles required for actual memory or bus access. in write access, for example, although the cpu finishes the mem stage by only writing to the write buffer, this operation actually is followed by a write to memory. depending on the memory or bus state before or after the cpu requested a memory access, the instruction processing may take more time than the calculated value. n r (read cycle) cycles when existing in instruction queue ............................................................................. 1 when reading internal resource (rom, ram) ........................................................... 1 when reading internal resource (sfr)(byte, halfword) .............................................. 2 when reading internal resource (sfr)(word) ............................................................ 4 when reading external memory (byte, halfword) ....................................................... 5 (note) when reading external memory (word) ...................................................................... 9 (note) when successively fetching instructions from external memory ................................ 8 (note) n w (write cycle) cycles when writing to internal resource (ram) ................................................................... 1 when writing to internal resource (sfr)(byte, halfword) ........................................... 2 when writing to internal resource (sfr)(word) .......................................................... 4 when writing to external memory (byte, halfword) ..................................................... 4 (note) when writing to external memory (word) .................................................................... 8 (note) note: this applies for external access with one wait cycle. (when the 32170 accesses external circuits, it requires at least one wait cycle inserted.)
appendix 2 appendix 2-4 ver.0.10 instruction processing time appendix 2.1 32170 instruction processing time j this is a blank page. j
appendix 3.1 precautions about noise appendix 3 appendix 3 precautions about noise
appendix 3 appendix 3-2 ver.0.10 precautions about noise appendix 3.1 precautions about noise appendix 3.1 precautions about noise the following describes precautions to be taken about noise and corrective measures against noise. the corrective measures described here are theoretically effective for noise, but require that the application system with these measures incorporated be fully evaluated before it can actually be put to use. appendix 3.1.1 reduction of wiring length wiring on the board may serve as an antenna to draws noise into the microcomputer. shorter the total wiring length, the smaller the possibility of drawing noise into the microcomputer. ____________ (1) wiring of the reset pin _____________ reduce the length of wiring connecting to the reset pin. especially when connecting a _____________ capacitor between the reset and vss pins, make sure it is connected to each pin with the shortest possible wiring (within 20 mm). reset is a function to initialize the internal logic of the microcomputer. the pulse width applied _____________ to the reset pin is important and is therefore stipulated as part of timing requirements. if _____________ noise in pulse width shorter than the stipulated duration is applied to the reset pin, reset will be negated before the internal logic of the microcomputer is fully initialized, causing the program to go wild. ____________ figure 3.1.1 wiring of the reset pin reset reset circuit noise vss vss reset circuit vss reset vss
appendix 3 appendix 3-3 ver.0.10 instruction processing time appendix 3.1 precautions about noise (2) wiring of clock input/output pins reduce the length of wiring connecting to the clock input/output pins. when connecting a capacitor to the oscillator, make sure its ground lead wire and the vss pin on the microcomputer are connected with the shortest possible wiring (within 20 mm). also, make sure the vss pattern for clock oscillation is used for only the oscillator circuit and is separated from other vss patterns. the microcomputer operates synchronously with the clock generated by the oscillator circuit. inclusion of noise on clock input/output pins causes the clock waveform to become distorted, which may result in the microcomputer operating erratically or getting out of control. also, if a noise-induced potential difference exists between the microcomputer's vss level and the oscillator's vss level, the clock fed into the microcomputer may not be an exact clock. figure 3.1.2 wiring of clock input/output pins (3) wiring of operation mode setup pins when connecting operation mode setup pins and the vcc or vss pin, make sure they are connected with the shortest possible wiring. the levels of operation mode setup pins affect the microcomputer's operation mode. when connecting operation mode setup pins and the vcc or vss pin, be careful that no noise- induced potential difference will exist between operation mode setup pins and the vcc or vss pin. this is because the presence of such a potential difference makes operation mode instable, which may result in the microcomputer operating erratically or getting out of control. figure 3.1.3 example for wiring of mod0 and mod1 pins xin xout vss xin xout vss noise vss operation mode setup pins vss noise operation mode setup pins
appendix 3 appendix 3-4 ver.0.10 precautions about noise appendix 3.1 precautions about noise appendix 3.1.2 inserting a bypass capacitor between vss and vcc lines insert a bypass capacitor of about 0.1 m f between vss and vcc lines in such a way as to meet the requirements described below. the wiring length between vss pin and bypass capacitor and that between vcc pin and bypass capacitor are equal. the wiring length between vss pin and bypass capacitor and that between vcc pin and bypass capacitor are the shortest possible. the vss and vcc lines are comprised of wiring in greater width than that of other signal lines. figure 3.1.4 bypass capacitor between vss and vcc lines aa aa aaa aaa aaa aaa a aa aa aa aa aa aa aa aa a a a a a a aa aa vss vcc chip vss vcc vss vcc chip
appendix 3 appendix 3-5 ver.0.10 instruction processing time appendix 3.1 precautions about noise appendix 3.1.3 processing analog input pin wiring connect a resistor of about 100 to 500 w ( in series to the analog signal wire connecting to the analog input pin at a position as close to the microcomputer as possible. also, insert a capacitor of about 100 pf between the analog input pin and avss pin at a position as close to the avss pin as possible. the signal fed into the analog input pin (e.g., a-d converter input pin) normally is an output signal from a sensor. in many cases, a sensor to detect changes of event is located apart from the board on which the microcomputer is mounted, so that wiring to the analog input pin inevitably is long. because a long wiring serves as an antenna which draws noise into the microcomputer, the signal fed into the analog input pin tends to be noise-ridden. furthermore, if the capacitor connected between the analog input pin and avss pin is grounded at a position apart from the avss pin, noise ridding on the ground line may penetrate into the microcomputer via the capacitor. figure 3.1.5 resistor and capacitor for analog signal line analog input pin avss sensor noise micro- computer
appendix 3 appendix 3-6 ver.0.10 precautions about noise appendix 3.1 precautions about noise appendix 3.1.4 consideration about the oscillator the oscillator that generates the fundamental clock for microcomputer operation requires consideration to make it less susceptible to influences from other signals. (1) avoidance from large-current signal lines signal lines in which a large current flows exceeding the range of current values that the microcomputer can handle must be routed as far away from the microcomputer (especially the oscillator) as possible. systems using the microcomputer contain signal lines to control, for example, a motor, led, and thermal head. when a large current flows in these signal lines, it generates noise due to mutual inductance. figure 3.1.6 wiring of large-current signal lines xin xout vss m mutual inductance large current gnd microcomputer
appendix 3 appendix 3-7 ver.0.10 instruction processing time appendix 3.1 precautions about noise (2) avoiding effects of rapidly level-changing signal lines locate signal lines whose levels change rapidly as far away from the oscillator as possible. also, make sure rapidly level-changing signal lines will not intersect clock-related signal lines and other noise-sensitive signal lines. rapidly level-changing signal lines tend to affect other signal lines as their voltage level frequently rises and falls. especially if they intersect clock-related signal lines, they will cause the clock waveform to become distorted, which may result in the microcomputer operating erratically or getting out of control. figure 3.1.7 wiring of rapidly level-changing signal lines (i = 0 to 3) xin xout vss high-speed serial i/o high-speed timer input/output, etc. do not intersect signal lines
appendix 3 appendix 3-8 ver.0.10 precautions about noise appendix 3.1 precautions about noise appendix 3.1.5 processing input/output ports for input/output ports, take the appropriate measures in both hardware and software following the procedure described below. hardware measures _ insert resistors of 100 w (or more) in series to input/output ports. software measures ? for input ports, read out data in a program two or more times to verify that levels match. ? for output ports, rewrite the data register at certain intervals, because there is a possibility of the output data being inverted by noise. ? rewrite the direction register at certain intervals. noise direction register data register data bus input/output port noise figure 3.1.8 processing input/output ports
mitsubishi 32-bit risc single-chip microcomputers m32r family m32r/e series 32170 group users manual ver 0.10 march 17, 2000 copyright ? 2000 mitsubishi electric corporation copyright ? 2000 mitsubishi electric semiconductor systems corporation all rights reversed. no part of this manual may be reproduced or distributed in any form or by any means without the written permission of mitsubishi.
msd-m32170-u-0003 mitsubishi electric corporation mitsubishi electric semiconductor systems corporation m32r family m32r/e series 32170 group users manual


▲Up To Search▲   

 
Price & Availability of M32170F4VWG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X